Changeset 44929 for trunk/src/wp-content/plugins/hello.php
- Timestamp:
- 03/18/2019 05:18:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/plugins/hello.php
r44229 r44929 2 2 /** 3 3 * @package Hello_Dolly 4 * @version 1.7. 14 * @version 1.7.2 5 5 */ 6 6 /* … … 9 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 10 Author: Matt Mullenweg 11 Version: 1.7. 111 Version: 1.7.2 12 12 Author URI: http://ma.tt/ 13 13 */ … … 26 26 One of our old favorite songs from way back when 27 27 So, take her wrap, fellas 28 Dolly, never go away again 28 Dolly, never go away again 29 29 Hello, Dolly 30 30 Well, hello, Dolly … … 43 43 Dolly'll never go away again"; 44 44 45 // Here we split it into lines 45 // Here we split it into lines. 46 46 $lyrics = explode( "\n", $lyrics ); 47 47 48 // And then randomly choose a line 48 // And then randomly choose a line. 49 49 return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); 50 50 } 51 51 52 // This just echoes the chosen line, we'll position it later 52 // This just echoes the chosen line, we'll position it later. 53 53 function hello_dolly() { 54 54 $chosen = hello_dolly_get_lyric(); 55 echo "<p id='dolly'>$chosen</p>"; 55 $lang = ''; 56 if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) { 57 $lang = ' lang="en"'; 58 } 59 60 printf( 61 '<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>', 62 __( 'Quote from Hello Dolly song, by Jerry Herman:' ), 63 $lang, 64 $chosen 65 ); 56 66 } 57 67 58 // Now we set that function up to execute when the admin_notices action is called 68 // Now we set that function up to execute when the admin_notices action is called. 59 69 add_action( 'admin_notices', 'hello_dolly' ); 60 70 61 // We need some CSS to position the paragraph 71 // We need some CSS to position the paragraph. 62 72 function dolly_css() { 63 // This makes sure that the positioning is also good for right-to-left languages64 $x = is_rtl() ? 'left' : 'right';65 66 73 echo " 67 74 <style type='text/css'> 68 75 #dolly { 69 float: $x; 70 padding-$x: 15px; 71 padding-top: 5px; 76 float: right; 77 padding: 5px 10px; 72 78 margin: 0; 73 font-size: 11px; 79 font-size: 12px; 80 line-height: 1.6666; 81 } 82 .rtl #dolly { 83 float: left; 74 84 } 75 85 .block-editor-page #dolly { 76 86 display: none; 87 } 88 @media screen and (max-width: 782px) { 89 #dolly, 90 .rtl #dolly { 91 float: none; 92 padding-left: 0; 93 padding-right: 0; 94 } 77 95 } 78 96 </style> … … 81 99 82 100 add_action( 'admin_head', 'dolly_css' ); 83 84
Note: See TracChangeset
for help on using the changeset viewer.