Permalink
Browse files

Replace deprectaed create_function with anonymous function

  • Loading branch information...
J0WI committed Jan 13, 2019
1 parent 0770188 commit 1121f2b6c6db79c95eaff7dacb2ae4b0ef0114c1
Showing with 2 additions and 2 deletions.
  1. +2 −2 includes/functions-html.php
@@ -828,7 +828,7 @@ function yourls_html_menu() {
/*
To display a notice:
$message = "<div>OMG, dude, I mean!</div>" );
yourls_add_action( 'admin_notices', create_function( '', "echo '$message';" ) );
yourls_add_action( 'admin_notices', function() use ( $message ) { echo (string) $message; } );
*/
}
@@ -839,7 +839,7 @@ function yourls_html_menu() {
function yourls_add_notice( $message, $style = 'notice' ) {
// Escape single quotes in $message to avoid breaking the anonymous function
$message = yourls_notice_box( strtr( $message, array( "'" => "\'" ) ), $style );
yourls_add_action( 'admin_notices', create_function( '', "echo '$message';" ) );
yourls_add_action( 'admin_notices', function() use ( $message ) { echo (string) $message; } );
}
/**

0 comments on commit 1121f2b

Please sign in to comment.