Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions hello.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
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.
Author: Matt Mullenweg
Version: 1.7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Author URI: http://ma.tt/
*/

// Do not load directly.
if ( ! defined( 'ABSPATH' ) ) {
die();
}

function hello_dolly_get_lyric() {
/** These are the lyrics to Hello Dolly */
$lyrics = "Hello, Dolly
Expand Down Expand Up @@ -46,22 +53,22 @@ function hello_dolly_get_lyric() {
$lyrics = explode( "\n", $lyrics );

// And then randomly choose a line.
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
return wptexturize( $lyrics[ wp_rand( 0, count( $lyrics ) - 1 ) ] ); // FIX: Changed mt_rand to wp_rand
}

// This just echoes the chosen line, we'll position it later.
function hello_dolly() {
$chosen = hello_dolly_get_lyric();
$lang = '';
$lang   = '';
if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
$lang = ' lang="en"';
}

printf(
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
$lang,
$chosen
esc_html__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
esc_attr( $lang ), // FIX: Added esc_attr
esc_html( $chosen ) // FIX: Added esc_html
);
}

Expand Down