Make WordPress Core

Ticket #22058: 22058.4.patch

File 22058.4.patch, 6.9 KB (added by sebastian.pisula, 9 years ago)

Patch for 4.5-alpha-36677

  • wp-includes/theme.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    13801380                        $repeat = 'repeat';
    13811381                $repeat = " background-repeat: $repeat;";
    13821382
    1383                 $position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    1384                 if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    1385                         $position = 'left';
    1386                 $position = " background-position: top $position;";
     1383                $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
     1384                if ( ! in_array( $position_x, array( 'center', 'right', 'left' ) ) )
     1385                        $position_x = 'left';
     1386
     1387                $position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
     1388                if ( ! in_array( $position_y, array( 'center', 'top', 'bottom' ) ) )
     1389                        $position_y = 'top';
     1390
     1391                $position = " background-position: $position_y $position_x;";
    13871392
    13881393                $attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
    13891394                if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
  • wp-admin/custom-background.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    151151                        set_theme_mod('background_position_x', $position);
    152152                }
    153153
     154                if ( isset($_POST['background-position-y']) ) {
     155                        check_admin_referer('custom-background');
     156                        if ( in_array($_POST['background-position-y'], array('center', 'top', 'bottom')) )
     157                                $position = $_POST['background-position-y'];
     158                        else
     159                                $position = 'top';
     160                        set_theme_mod('background_position_y', $position);
     161                }
     162
    154163                if ( isset($_POST['background-attachment']) ) {
    155164                        check_admin_referer('custom-background');
    156165                        if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
     
    223232                        // Background-image URL must be single quote, see below.
    224233                        $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
    225234                                . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
    226                                 . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
     235                                . ' background-position: '. get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) .' ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
    227236                }
    228237        ?>
    229238        <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
     
    293302<tbody>
    294303<?php if ( get_background_image() ) : ?>
    295304<tr>
    296 <th scope="row"><?php _e( 'Position' ); ?></th>
     305<th scope="row"><?php _e( 'Position X' ); ?></th>
    297306<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
    298307<label>
    299308<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
     
    306315<label>
    307316<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
    308317<?php _e('Right') ?>
    309 </label>
    310 </fieldset></td>
    311 </tr>
     318</label>
     319</fieldset></td>
     320</tr>
     321
     322        <tr>
     323                <th scope="row"><?php _e( 'Position Y' ); ?></th>
     324                <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
     325                                <label>
     326                                        <input name="background-position-y" type="radio" value="left"<?php checked( 'top', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> />
     327                                        <?php _e('Top') ?>
     328                                </label>
     329                                <label>
     330                                        <input name="background-position-y" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> />
     331                                        <?php _e('Center') ?>
     332                                </label>
     333                                <label>
     334                                        <input name="background-position-y" type="radio" value="right"<?php checked( 'bottom', get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) ) ); ?> />
     335                                        <?php _e('Bottom') ?>
     336                                </label>
     337                        </fieldset></td>
     338        </tr>
    312339
    313340<tr>
    314341<th scope="row"><?php _e( 'Repeat' ); ?></th>
  • wp-includes/class-wp-customize-manager.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    20592059                ) );
    20602060
    20612061                $this->add_control( 'background_position_x', array(
    2062                         'label'      => __( 'Background Position' ),
     2062                        'label'      => __( 'Background Position X' ),
    20632063                        'section'    => 'background_image',
    20642064                        'type'       => 'radio',
    20652065                        'choices'    => array(
     
    20692069                        ),
    20702070                ) );
    20712071
     2072                $this->add_setting( 'background_position_y', array(
     2073                                'default'        => get_theme_support( 'custom-background', 'default-position-y' ),
     2074                                'theme_supports' => 'custom-background',
     2075                ) );
     2076
     2077                $this->add_control( 'background_position_y', array(
     2078                                'label'   => __( 'Background Position Y' ),
     2079                                'section' => 'background_image',
     2080                                'type'    => 'radio',
     2081                                'choices' => array(
     2082                                                'top'    => __( 'Top' ),
     2083                                                'center' => __( 'Center' ),
     2084                                                'bottom' => __( 'Bottom' ),
     2085                                ),
     2086                ) );
     2087
    20722088                $this->add_setting( 'background_attachment', array(
    20732089                        'default'        => get_theme_support( 'custom-background', 'default-attachment' ),
    20742090                        'theme_supports' => 'custom-background',
     
    20872103                // If the theme is using the default background callback, we can update
    20882104                // the background CSS using postMessage.
    20892105                if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) {
    2090                         foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) {
     2106                        foreach ( array( 'color', 'image', 'position_x', 'position_y', 'repeat', 'attachment' ) as $prop ) {
    20912107                                $this->get_setting( 'background_' . $prop )->transport = 'postMessage';
    20922108                        }
    20932109                }