Make WordPress Core

Ticket #43632: 43632.7.diff

File 43632.7.diff, 1.7 KB (added by audrasjb, 6 years ago)

Refresh + move lang attribute to <p> tag

  • src/wp-content/plugins/hello.php

    diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php
    index 189653b..bf8040c 100644
    a b Description: This is not just a plugin, it symbolizes the hope and enthusiasm of 
    1010Author: Matt Mullenweg
    1111Version: 1.7.1
    1212Author URI: http://ma.tt/
     13Text Domain: hello-dolly
    1314*/
    1415
    1516function hello_dolly_get_lyric() {
    Dolly'll never go away again"; 
    5253// This just echoes the chosen line, we'll position it later
    5354function hello_dolly() {
    5455        $chosen = hello_dolly_get_lyric();
    55         echo "<p id='dolly'>$chosen</p>";
     56        $lang = '';
     57        if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
     58                $lang = " lang='en'";
     59        }
     60       
     61        printf(
     62                '<p id="dolly"%s><span class="screen-reader-text">%s </span><span>%s</span></p>',
     63                $lang,
     64                __( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
     65                $chosen
     66        );
    5667}
    5768
    5869// Now we set that function up to execute when the admin_notices action is called
    add_action( 'admin_notices', 'hello_dolly' ); 
    6071
    6172// We need some CSS to position the paragraph
    6273function dolly_css() {
    63         // This makes sure that the positioning is also good for right-to-left languages
    64         $x = is_rtl() ? 'left' : 'right';
    65 
    6674        echo "
    6775        <style type='text/css'>
    6876        #dolly {
    69                 float: $x;
    70                 padding-$x: 15px;
    71                 padding-top: 5px;               
     77                float: right;
     78                padding: 6px 10px 4px 0;
    7279                margin: 0;
     80                line-height: 1.7;
    7381                font-size: 11px;
    7482        }
     83        body.rtl #dolly {
     84                float: left;
     85                padding: 6px 0 4px 10px;
     86        }
    7587        .block-editor-page #dolly {
    7688                display: none;
    7789        }
     90        @media screen and (max-width: 782px) {
     91                #dolly {
     92                        float: none;
     93                }
     94        }
    7895        </style>
    7996        ";
    8097}