Hello Dolly - Version 1.6

Version Description

Download this release

Release Info

Developer Otto42
Plugin Icon 128x128 Hello Dolly
Version 1.6
Comparing to
See all releases

Code changes from version 1.5 to 1.6

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