slug = $slug; $this->message = $message; $this->type = $type; // Add actions. add_action( 'admin_notices', array( $this, 'display_admin_notice' ) ); add_action( 'wp_ajax_ogf_dismiss_notice', array( $this, 'dismiss_notice' ) ); add_action( 'admin_init', array( $this, 'dismiss_notice_backup' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); } /** * Enqeue the styles and scripts. */ public function enqueue() { wp_enqueue_script( 'ogf-admin', esc_url( OGF_DIR_URL . 'assets/js/admin.js' ), array( 'jquery' ), OGF_VERSION, false ); } /** * AJAX handler to store the state of dismissible notices. */ public function dismiss_notice() { if ( isset( $_POST['type'] ) ) { // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice). $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); update_option( 'dismissed-' . $type, true ); } } /** * Backup method to remove notice. */ public function dismiss_notice_backup() { if ( isset( $_GET['dismiss_ogf_welcome'] ) ) { update_option( 'dismissed-' . $this->slug, true ); } } /** * Display the admin notice. */ public function display_admin_notice() { if ( get_option( 'dismissed-' . $this->slug, false ) ) { return; } ?>

message; // WPCS: XSS ok. ?>

Google Fonts for WordPress! Configure your fonts here: WordPress Customizer', 'olympus-google-fonts' ), esc_url( admin_url( '/customize.php?autofocus[panel]=ogf_google_fonts' ) ) ); /* * Instantiate the OGF_Welcome class. */ new OGF_Welcome( 'ogf-welcome', $message, 'success' );