false, 'cap' => 'edit_posts', 'content' => '', 'class' => 'notice-info', 'only' => 'options-general.php?page=fl-builder-settings', ); $notice = wp_parse_args( $args, $defaults ); if ( $notice['id'] ) { self::$notices[] = $notice; } } static public function enqueue_scripts() { $notices = array(); foreach ( self::$notices as $notice ) { if ( ! current_user_can( $notice['cap'] ) || self::is_dismissed( $notice['id'] ) ) { continue; } unset( $notice['content'] ); $notices[] = $notice; } if ( empty( $notices ) ) { return; } wp_enqueue_script( 'fl-builder-admin-notices', FLBuilder::plugin_url() . '/js/fl-builder-admin-notices.js', array( 'jquery' ), FL_BUILDER_VERSION, true ); wp_localize_script( 'fl-builder-admin-notices', 'FLBuilderAdminNoticesConfig', array( 'notices' => $notices, 'notice_nonce' => wp_create_nonce( 'dismiss_fl_notice', 'notice_nonce' ), 'ajaxurl' => admin_url( 'admin-ajax.php' ), ) ); } static public function render_notices() { $notices = array(); foreach ( self::$notices as $notice ) { if ( ! current_user_can( $notice['cap'] ) || self::is_dismissed( $notice['id'] ) ) { continue; } if ( $notice['only'] && basename( home_url( $_SERVER['REQUEST_URI'] ) ) !== $notice['only'] ) { continue; } printf( '
%s