[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Hello_Dolly 4 * @version 1.7.2 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.7.2 12 Author URI: http://ma.tt/ 13 Text Domain: hello-dolly 14 */ 15 16 // Do not load directly. 17 if ( ! defined( 'ABSPATH' ) ) { 18 die(); 19 } 20 21 function hello_dolly_get_lyric() { 22 /** These are the lyrics to Hello Dolly */ 23 $lyrics = "Hello, Dolly 24 Well, hello, Dolly 25 It's so nice to have you back where you belong 26 You're lookin' swell, Dolly 27 I can tell, Dolly 28 You're still glowin', you're still crowin' 29 You're still goin' strong 30 I feel the room swayin' 31 While the band's playin' 32 One of our old favorite songs from way back when 33 So, take her wrap, fellas 34 Dolly, never go away again 35 Hello, Dolly 36 Well, hello, Dolly 37 It's so nice to have you back where you belong 38 You're lookin' swell, Dolly 39 I can tell, Dolly 40 You're still glowin', you're still crowin' 41 You're still goin' strong 42 I feel the room swayin' 43 While the band's playin' 44 One of our old favorite songs from way back when 45 So, golly, gee, fellas 46 Have a little faith in me, fellas 47 Dolly, never go away 48 Promise, you'll never go away 49 Dolly'll never go away again"; 50 51 // Here we split it into lines. 52 $lyrics = explode( "\n", $lyrics ); 53 54 // And then randomly choose a line. 55 return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); 56 } 57 58 // This just echoes the chosen line, we'll position it later. 59 function hello_dolly() { 60 $chosen = hello_dolly_get_lyric(); 61 $lang = ''; 62 if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) { 63 $lang = ' lang="en"'; 64 } 65 66 printf( 67 '<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>', 68 __( 'Quote from Hello Dolly song, by Jerry Herman:' ), 69 $lang, 70 $chosen 71 ); 72 } 73 74 // Now we set that function up to execute when the admin_notices action is called. 75 add_action( 'admin_notices', 'hello_dolly' ); 76 77 // We need some CSS to position the paragraph. 78 function dolly_css() { 79 echo " 80 <style type='text/css'> 81 #dolly { 82 float: right; 83 padding: 5px 10px; 84 margin: 0; 85 font-size: 12px; 86 line-height: 1.6666; 87 } 88 .rtl #dolly { 89 float: left; 90 } 91 .block-editor-page #dolly { 92 display: none; 93 } 94 @media screen and (max-width: 782px) { 95 #dolly, 96 .rtl #dolly { 97 float: none; 98 padding-left: 0; 99 padding-right: 0; 100 } 101 } 102 </style> 103 "; 104 } 105 106 add_action( 'admin_head', 'dolly_css' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Wed Sep 3 08:20:02 2025 | Cross-referenced by PHPXref |