WordPress.org

Make WordPress Core

Ticket #39892: 39892.patch

File 39892.patch, 2.4 KB (added by denisco, 7 months ago)
  • src/wp-includes/class-wp-customize-manager.php

    From 487af08ce70068e5039a22382ae83460e8306635 Mon Sep 17 00:00:00 2001
    From: denis <denis@deniska>
    Date: May 5, 2017 10:30:47 PM
    
    Replaced Additional CSS default value to placeholder
    
    diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
    index 5fb2d76..cea83f1 100644
    a b  
    41494149                ) ); 
    41504150 
    41514151                $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 
    4152                         'capability' => 'edit_css', 
    4153                         'default' => sprintf( "/*\n%s\n*/", __( "You can add your own CSS here.\n\nClick the help icon above to learn more." ) ), 
     4152                        'capability' => 'edit_css' 
    41544153                ) ); 
    41554154                $this->add_setting( $custom_css_setting ); 
    41564155 
     
    41604159                        'settings' => array( 'default' => $custom_css_setting->id ), 
    41614160                        'input_attrs' => array( 
    41624161                                'class' => 'code', // Ensures contents displayed as LTR instead of RTL. 
     4162                                'placeholder' => __( 'You can add your own CSS here.\n\nClick the help icon above to learn more.' ), 
    41634163                        ), 
    41644164                ) ); 
    41654165        } 
  • src/wp-includes/customize/class-wp-customize-custom-css-setting.php

    diff --git a/src/wp-includes/customize/class-wp-customize-custom-css-setting.php b/src/wp-includes/customize/class-wp-customize-custom-css-setting.php
    index d694395..362183c 100644
    a b  
    140140                if ( $post ) { 
    141141                        $value = $post->post_content; 
    142142                } 
    143                 if ( empty( $value ) ) { 
    144                         $value = $this->default; 
    145                 } 
    146143 
    147144                /** This filter is documented in wp-includes/class-wp-customize-setting.php */ 
    148145                $value = apply_filters( "customize_value_{$id_base}", $value, $this ); 
  • tests/phpunit/tests/customize/custom-css-setting.php

    diff --git a/tests/phpunit/tests/customize/custom-css-setting.php b/tests/phpunit/tests/customize/custom-css-setting.php
    index 3dea39e..b9d6ac0 100644
    a b  
    109109         * @covers WP_Customize_Custom_CSS_Setting::update() 
    110110         */ 
    111111        function test_crud() { 
    112  
    113                 $this->setting->default = '/* Hello World */'; 
    114                 $this->assertEquals( $this->setting->default, $this->setting->value() ); 
    115  
    116112                $this->assertNull( wp_get_custom_css_post() ); 
    117113                $this->assertNull( wp_get_custom_css_post( $this->setting->stylesheet ) ); 
    118114                $this->assertNull( wp_get_custom_css_post( 'twentyten' ) );