[ Index ] |
WordPress Cross Reference |
[Summary view] [Print] [Text view]
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 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |