Make WordPress Core

Ticket #29540: 29540.diff

File 29540.diff, 5.8 KB (added by mattheu, 11 years ago)
  • new file src/wp-content/plugins/hello-dolly/hello.php

    diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello-dolly/hello.php
    new file mode 100644
    index 0000000..2a4e150
    - +  
     1<?php
     2/**
     3 * @package Hello_Dolly
     4 * @version 1.6
     5 */
     6/*
     7Plugin Name: Hello Dolly
     8Plugin URI: http://wordpress.org/extend/plugins/hello-dolly/
     9Description: 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.
     10Author: Matt Mullenweg
     11Version: 1.6
     12Author URI: http://ma.tt/
     13*/
     14
     15function hello_dolly_get_lyric() {
     16        /** These are the lyrics to Hello Dolly */
     17        $lyrics = "Hello, Dolly
     18Well, hello, Dolly
     19It's so nice to have you back where you belong
     20You're lookin' swell, Dolly
     21I can tell, Dolly
     22You're still glowin', you're still crowin'
     23You're still goin' strong
     24We feel the room swayin'
     25While the band's playin'
     26One of your old favourite songs from way back when
     27So, take her wrap, fellas
     28Find her an empty lap, fellas
     29Dolly'll never go away again
     30Hello, Dolly
     31Well, hello, Dolly
     32It's so nice to have you back where you belong
     33You're lookin' swell, Dolly
     34I can tell, Dolly
     35You're still glowin', you're still crowin'
     36You're still goin' strong
     37We feel the room swayin'
     38While the band's playin'
     39One of your old favourite songs from way back when
     40Golly, gee, fellas
     41Find her a vacant knee, fellas
     42Dolly'll never go away
     43Dolly'll never go away
     44Dolly'll never go away again";
     45
     46        // Here we split it into lines
     47        $lyrics = explode( "\n", $lyrics );
     48
     49        // And then randomly choose a line
     50        return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
     51}
     52
     53// This just echoes the chosen line, we'll position it later
     54function hello_dolly() {
     55        $chosen = hello_dolly_get_lyric();
     56        echo "<p id='dolly'>$chosen</p>";
     57}
     58
     59// Now we set that function up to execute when the admin_notices action is called
     60add_action( 'admin_notices', 'hello_dolly' );
     61
     62// We need some CSS to position the paragraph
     63function dolly_css() {
     64        // This makes sure that the positioning is also good for right-to-left languages
     65        $x = is_rtl() ? 'left' : 'right';
     66
     67        echo "
     68        <style type='text/css'>
     69        #dolly {
     70                float: $x;
     71                padding-$x: 15px;
     72                padding-top: 5px;               
     73                margin: 0;
     74                font-size: 11px;
     75        }
     76        </style>
     77        ";
     78}
     79
     80add_action( 'admin_head', 'dolly_css' );
     81
     82?>
     83 No newline at end of file
  • new file src/wp-content/plugins/hello-dolly/readme.txt

    diff --git a/src/wp-content/plugins/hello-dolly/readme.txt b/src/wp-content/plugins/hello-dolly/readme.txt
    new file mode 100644
    index 0000000..f4f18af
    - +  
     1=== Hello Dolly ===
     2Contributors: matt
     3Requires at least: 3.0
     4Stable tag: 1.6
     5Tested up to: 4.0
     6
     7This 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.
     8
     9== Description ==
     10
     11This 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.
  • deleted file src/wp-content/plugins/hello.php

    diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php
    deleted file mode 100644
    index 2b1e07b..0000000
    + -  
    1 <?php
    2 /**
    3  * @package Hello_Dolly
    4  * @version 1.6
    5  */
    6 /*
    7 Plugin Name: Hello Dolly
    8 Plugin URI: http://wordpress.org/plugins/hello-dolly/
    9 Description: 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.
    10 Author: Matt Mullenweg
    11 Version: 1.6
    12 Author URI: http://ma.tt/
    13 */
    14 
    15 function hello_dolly_get_lyric() {
    16         /** These are the lyrics to Hello Dolly */
    17         $lyrics = "Hello, Dolly
    18 Well, hello, Dolly
    19 It's so nice to have you back where you belong
    20 You're lookin' swell, Dolly
    21 I can tell, Dolly
    22 You're still glowin', you're still crowin'
    23 You're still goin' strong
    24 We feel the room swayin'
    25 While the band's playin'
    26 One of your old favourite songs from way back when
    27 So, take her wrap, fellas
    28 Find her an empty lap, fellas
    29 Dolly'll never go away again
    30 Hello, Dolly
    31 Well, hello, Dolly
    32 It's so nice to have you back where you belong
    33 You're lookin' swell, Dolly
    34 I can tell, Dolly
    35 You're still glowin', you're still crowin'
    36 You're still goin' strong
    37 We feel the room swayin'
    38 While the band's playin'
    39 One of your old favourite songs from way back when
    40 Golly, gee, fellas
    41 Find her a vacant knee, fellas
    42 Dolly'll never go away
    43 Dolly'll never go away
    44 Dolly'll never go away again";
    45 
    46         // Here we split it into lines
    47         $lyrics = explode( "\n", $lyrics );
    48 
    49         // And then randomly choose a line
    50         return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
    51 }
    52 
    53 // This just echoes the chosen line, we'll position it later
    54 function hello_dolly() {
    55         $chosen = hello_dolly_get_lyric();
    56         echo "<p id='dolly'>$chosen</p>";
    57 }
    58 
    59 // Now we set that function up to execute when the admin_notices action is called
    60 add_action( 'admin_notices', 'hello_dolly' );
    61 
    62 // We need some CSS to position the paragraph
    63 function dolly_css() {
    64         // This makes sure that the positioning is also good for right-to-left languages
    65         $x = is_rtl() ? 'left' : 'right';
    66 
    67         echo "
    68         <style type='text/css'>
    69         #dolly {
    70                 float: $x;
    71                 padding-$x: 15px;
    72                 padding-top: 5px;               
    73                 margin: 0;
    74                 font-size: 11px;
    75         }
    76         </style>
    77         ";
    78 }
    79 
    80 add_action( 'admin_head', 'dolly_css' );
    81 
    82 ?>