Make WordPress Core

Ticket #43632: 43632.8.diff

File 43632.8.diff, 3.4 KB (added by afercia, 6 years ago)
  • src/wp-content/plugins/hello.php

     
    11<?php
    22/**
    33 * @package Hello_Dolly
    4  * @version 1.7.1
     4 * @version 1.7.2
    55 */
    66/*
    77Plugin Name: Hello Dolly
     
    88Plugin URI: http://wordpress.org/plugins/hello-dolly/
    99Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
    1010Author: Matt Mullenweg
    11 Version: 1.7.1
     11Version: 1.7.2
    1212Author URI: http://ma.tt/
    1313*/
    1414
     
    2525While the band's playin'
    2626One of our old favorite songs from way back when
    2727So, take her wrap, fellas
    28 Dolly, never go away again 
     28Dolly, never go away again
    2929Hello, Dolly
    3030Well, hello, Dolly
    3131It's so nice to have you back where you belong
     
    4242Promise, you'll never go away
    4343Dolly'll never go away again";
    4444
    45         // Here we split it into lines
     45        // Here we split it into lines.
    4646        $lyrics = explode( "\n", $lyrics );
    4747
    48         // And then randomly choose a line
     48        // And then randomly choose a line.
    4949        return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
    5050}
    5151
    52 // This just echoes the chosen line, we'll position it later
     52// This just echoes the chosen line, we'll position it later.
    5353function hello_dolly() {
    5454        $chosen = hello_dolly_get_lyric();
    55         echo "<p id='dolly'>$chosen</p>";
     55        $lang   = '';
     56        if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
     57                $lang = ' lang="en"';
     58        }
     59
     60        printf(
     61                '<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
     62                __( 'Quote from Hello Dolly song, by Jerry Herman:' ),
     63                $lang,
     64                $chosen
     65        );
    5666}
    5767
    58 // Now we set that function up to execute when the admin_notices action is called
     68// Now we set that function up to execute when the admin_notices action is called.
    5969add_action( 'admin_notices', 'hello_dolly' );
    6070
    61 // We need some CSS to position the paragraph
     71// We need some CSS to position the paragraph.
    6272function dolly_css() {
    63         // This makes sure that the positioning is also good for right-to-left languages
    64         $x = is_rtl() ? 'left' : 'right';
    65 
    6673        echo "
    6774        <style type='text/css'>
    6875        #dolly {
    69                 float: $x;
    70                 padding-$x: 15px;
    71                 padding-top: 5px;               
     76                float: right;
     77                padding: 5px 10px;
    7278                margin: 0;
    73                 font-size: 11px;
     79                font-size: 12px;
     80                line-height: 1.6666;
    7481        }
     82        .rtl #dolly {
     83                float: left;
     84        }
    7585        .block-editor-page #dolly {
    7686                display: none;
    7787        }
     88        @media screen and (max-width: 782px) {
     89                #dolly,
     90                .rtl #dolly {
     91                        float: none;
     92                        padding-left: 0;
     93                        padding-right: 0;
     94                }
     95        }
    7896        </style>
    7997        ";
    8098}
    8199
    82100add_action( 'admin_head', 'dolly_css' );
    83 
    84 
  • tests/phpunit/tests/ajax/UpdatePlugin.php

     
    158158                                'plugin'       => 'hello.php',
    159159                                'pluginName'   => 'Hello Dolly',
    160160                                'errorMessage' => 'Plugin update failed.',
    161                                 'oldVersion'   => 'Version 1.7.1',
     161                                'oldVersion'   => 'Version 1.7.2',
    162162                                'newVersion'   => '',
    163163                                'debug'        => array( 'The plugin is at the latest version.' ),
    164164                        ),