CalderaWP/dismissible_notice

Name: dismissible_notice

Owner: Caldera Labs

Description: Creates a dismissible--via AJAX--admin nag.

Created: 2015-02-04 04:45:31.0

Updated: 2018-04-07 17:07:21.0

Pushed: 2015-10-26 17:22:40.0

Homepage: null

Size: 251

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

A simple way to add an admin nag, that can be dismissed via AJAX.

Example

Show a warning if current version of PHP is less than 5.3.

add_action( 'plugins_loaded', 'caeq_bootstrap' );
function caeq_bootstrap(){

    if (  ! version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
        if ( is_admin() || defined( 'DOING_AJAX' ) && DOING_AJAX ) {
            include_once CAEQ_PATH . 'vendor/calderawp/dismissible-notice/src/callback_hook.php';
        }

        if ( is_admin() ) {
            //BIG nope nope nope!

            $message = sprintf( __( 'Caldera Easy Queries requires PHP version %1s or later. We strongly recommend PHP 5.4 or later for security and performance reasons. Current version is %2s.', '5.3.0', 'caldera-text-domain' ), PHP_VERSION );
            echo caldera_warnings_dismissible_notice( $message, true, 'activate_plugins' );
        }

    }else{
        //bootstrap plugin
        require_once( CAEQ_PATH . 'bootstrap.php' );

    }


Backwards Compat and such

This library was written with PHP 5.2 backwards-compat in mind. Hence the prefixed, instead of namespaced class name. You will also need to manually include the class.

License & Copyright

Copyright 2015 Josh Pollock

Licensed under the terms of the GNU General Public License version 2 or later. Please share with your neighbor.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.