Commit b6dab119 authored by Kenny Hall's avatar Kenny Hall

Added comments.

parent 2ee8856b
......@@ -2,11 +2,19 @@
class NF_Whip
{
/**
* NF_Whip constructor.
* Hooks into the WordPress admin notice system and calls our whip_message.
*/
public function __construct()
{
add_action( 'admin_notices', array( $this, 'whip_message' ) );
}
/**
* Whip Message
* Builds and outputs our message.
*/
public function whip_message()
{
$message = array();
......@@ -27,8 +35,9 @@ class NF_Whip
sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) )
);
// Change our array to string to be displayed.
$message = implode( $message, "\n" );
echo '<div class="notice notice-error">' . $message . '</div>';
echo '<div class="notice notice-error">' . $message . '</div>';
}
}
\ No newline at end of file
......@@ -367,7 +367,9 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
add_action( 'init', array( self::$instance, 'init' ), 5 );
add_action( 'admin_init', array( self::$instance, 'admin_init' ), 5 );
// Checks php version and..
if( PHP_VERSION < 5.6 ) {
// Pulls in the whip notice if the user is.
add_action( 'admin_init', array( self::$instance, 'nf_whip_notice' ) );
}
......@@ -389,6 +391,13 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
add_filter( 'ninja_forms_dashboard_menu_items', array( $this, 'maybe_hide_dashboard_items' ) );
}
/**
* NF Whip Notice
* If the user is on a version below PHP 5.6 then we get an instance of the
* NF Whip class which will add a non-dismissible admin notice.
*
* @return NF_Whip
*/
public function nf_whip_notice()
{
require_once self::$dir . '/includes/Libraries/Whip/NF_Whip.php';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment