source: trunk/www.guidonia.net/wp/wp-content/plugins/hello.php@ 44

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