AnsPress_Admin::anspress_notice()
Description #
Show AnsPress notices.
Source #
File: admin/anspress-admin.php
public static function anspress_notice() { $page = get_current_screen(); $anspress_updates = get_option( 'anspress_updates', array() ); $have_updates = empty( $anspress_updates ) || in_array( false, $anspress_updates, true ); $messages = array( 'db' => array( 'type' => 'error', 'message' => __( 'AnsPress database is not updated.', 'anspress-question-answer' ), 'button' => ' <a class="button" href="' . admin_url( 'admin-post.php?action=anspress_update_db' ) . '">' . __( 'Update now', 'anspress-question-answer' ) . '</a>', 'show' => ( get_option( 'anspress_db_version' ) != AP_DB_VERSION ), // phpcs:ignore Universal.Operators.StrictComparisons.LooseNotEqual ), 'missing_pages' => array( 'type' => 'error', 'message' => __( 'One or more AnsPress page(s) does not exists.', 'anspress-question-answer' ), 'button' => ' <a href="' . admin_url( 'admin-post.php?action=anspress_create_base_page' ) . '">' . __( 'Set automatically', 'anspress-question-answer' ) . '</a> ' . __( 'Or', 'anspress-question-answer' ) . ' <a href="' . admin_url( 'admin.php?page=anspress_options' ) . '">' . __( 'Set set by yourself', 'anspress-question-answer' ) . '</a>', 'show' => ( ! self::check_pages_exists() ), ), ); /** * Filter the AnsPress admin notices before they're output. * * @param array $messages List of notices. */ $messages = apply_filters( 'ap_admin_notices', $messages ); foreach ( $messages as $msg ) { if ( $msg['show'] ) { $class = 'ap-notice notice notice-' . $msg['type']; echo wp_kses_post( sprintf( '<div class="%1$s %4$s"><p>%2$s%3$s</p></div>', esc_attr( $class ), esc_html( $msg['message'] ), $msg['button'], 'apicon-anspress-icon' ) ); } } }
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:685
Add your comment