calderawp/dismissible-notice

创建一个可通过AJAX删除的admin提示。

0.3.0 2015-08-24 20:27 UTC

This package is auto-updated.

Last update: 2024-09-08 06:31:48 UTC


README

添加admin提示的简单方法,可以通过AJAX删除。

示例

如果当前PHP版本小于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' );
    
    	}

}

向下兼容性等

这个库是用PHP 5.2向下兼容性考虑编写的。因此使用了前缀而不是命名空间。您还需要手动包含该类。

许可证 & 版权

版权所有 2015 Josh Pollock

根据GNU通用公共许可证第二版或更新版许可。请与您的邻居分享。