root/trunk/wp-content/plugins/hello.php

Revision 9001, 2.0 kB (checked in by westi, 2 weeks ago)

phpdoc for hello dolly. See #7550 props jacobsantos.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * @package Hello_Dolly
4  */
5 /*
6 Plugin Name: Hello Dolly
7 Plugin URI: http://wordpress.org/#
8 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.
9 Author: Matt Mullenweg
10 Version: 1.5
11 Author URI: http://ma.tt/
12 */
13
14 /** These are the lyrics to Hello Dolly */
15 $lyrics = "Hello, Dolly
16 Well, hello, Dolly
17 It's so nice to have you back where you belong
18 You're lookin' swell, Dolly
19 I can tell, Dolly
20 You're still glowin', you're still crowin'
21 You're still goin' strong
22 We feel the room swayin'
23 While the band's playin'
24 One of your old favourite songs from way back when
25 So, take her wrap, fellas
26 Find her an empty lap, fellas
27 Dolly'll never go away again
28 Hello, Dolly
29 Well, hello, Dolly
30 It's so nice to have you back where you belong
31 You're lookin' swell, Dolly
32 I can tell, Dolly
33 You're still glowin', you're still crowin'
34 You're still goin' strong
35 We feel the room swayin'
36 While the band's playin'
37 One of your old favourite songs from way back when
38 Golly, gee, fellas
39 Find her a vacant knee, fellas
40 Dolly'll never go away
41 Dolly'll never go away
42 Dolly'll never go away again";
43
44 // Here we split it into lines
45 $lyrics = explode("\n", $lyrics);
46 // And then randomly choose a line
47 $chosen = wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
48
49 // This just echoes the chosen line, we'll position it later
50 function hello_dolly() {
51     global $chosen;
52     echo "<p id='dolly'>$chosen</p>";
53 }
54
55 // Now we set that function up to execute when the admin_footer action is called
56 add_action('admin_footer', 'hello_dolly');
57
58 // We need some CSS to position the paragraph
59 function dolly_css() {
60     echo "
61     <style type='text/css'>
62     #dolly {
63         position: absolute;
64         top: 2.3em;
65         margin: 0;
66         padding: 0;
67         right: 10px;
68         font-size: 16px;
69         color: #d54e21;
70     }
71     </style>
72     ";
73 }
74
75 add_action('admin_head', 'dolly_css');
76
77 ?>
Note: See TracBrowser for help on using the browser.