bsf_notices()
Display admin notices.
Description
Return
(bool)
Source
File: admin/bsf-core/auto-update/admin-functions.php
function bsf_notices() { global $pagenow; if ( 'update-core.php' === $pagenow || 'plugins.php' === $pagenow || 'post-new.php' === $pagenow || 'edit.php' === $pagenow || 'post.php' === $pagenow ) { $brainstrom_products = get_option( 'brainstrom_products' ); $brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() ); if ( empty( $brainstrom_products ) ) { return false; } $brainstrom_bundled_products_keys = array(); if ( ! empty( $brainstrom_bundled_products ) ) : foreach ( $brainstrom_bundled_products as $bps ) { foreach ( $bps as $key => $bp ) { array_push( $brainstrom_bundled_products_keys, $bp->id ); } } endif; $mix = array(); $plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array(); $themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array(); $mix = array_merge( $plugins, $themes ); if ( empty( $mix ) ) { return false; } if ( ( defined( 'BSF_PRODUCTS_NOTICES' ) && ( 'false' === BSF_PRODUCTS_NOTICES || false === BSF_PRODUCTS_NOTICES ) ) ) { return false; } $is_multisite = is_multisite(); $is_network_admin = is_network_admin(); foreach ( $mix as $product ) : if ( ! isset( $product['id'] ) ) { continue; } if ( false === apply_filters( "bsf_display_product_activation_notice_{$product['id']}", true ) ) { continue; } if ( isset( $product['is_product_free'] ) && ( 'true' === $product['is_product_free'] || true === $product['is_product_free'] ) ) { continue; } $constant = strtoupper( str_replace( '-', '_', $product['id'] ) ); $constant_nag = 'BSF_' . $constant . '_NAG'; $constant_notice = 'BSF_' . $constant . '_NOTICES'; if ( defined( $constant_nag ) && ( 'false' === constant( $constant_nag ) || false === constant( $constant_nag ) ) ) { continue; } if ( defined( $constant_notice ) && ( 'false' === constant( $constant_notice ) || false === constant( $constant_notice ) ) ) { continue; } $status = ( isset( $product['status'] ) ) ? $product['status'] : false; $type = ( isset( $product['type'] ) ) ? $product['type'] : false; if ( ! $type ) { continue; } if ( 'plugin' === $type ) { if ( ! is_plugin_active( $product['template'] ) ) { continue; } } elseif ( 'theme' === $type ) { $theme = wp_get_theme(); if ( $product['template'] !== $theme->template ) { continue; } } else { continue; } if ( BSF_Update_Manager::bsf_is_product_bundled( $product['id'] ) ) { continue; } if ( 'registered' !== $status ) : $url = bsf_registration_page_url( '', $product['id'] ); $message = __( 'Please', 'bsf' ) . ' <a href="' . esc_url( $url ) . '" class="bsf-core-license-form-btn" plugin-slug="' . esc_html( $product['id'] ) . '">' . __( 'activate', 'bsf' ) . '</a> ' . __( 'your copy of the', 'bsf' ) . ' <i>' . esc_html( $product['product_name'] ) . '</i> ' . __( 'to get update notifications, access to support features & other resources!', 'bsf' ); $message = apply_filters( "bsf_product_activation_notice_{$product['id']}", $message, $url, $product['product_name'] ); $allowed_html = array( 'a' => array( 'href' => array(), 'class' => array(), 'title' => array(), 'plugin-slug' => array(), ), 'br' => array(), 'em' => array(), 'strong' => array(), 'i' => array(), ); if ( ( $is_multisite && $is_network_admin ) || ! $is_multisite ) { echo '<div class="notice notice-warning"><p>' . wp_kses( $message, $allowed_html ) . '</p></div>'; } endif; endforeach; } }
Expand full source code Collapse full source code View on Trac