nonce = wp_create_nonce( 'install-plugin_yaymail' ); $this->autoInstallUrl = self_admin_url( 'update.php?action=install-plugin&plugin=yaymail&_wpnonce=' . $this->nonce ); } else { $this->autoInstallUrl = admin_url( 'plugin-install.php?s=yaymail&tab=search&type=term' ); } add_action( 'admin_init', array( $this, 'init' ) ); } public function init() { add_action( 'admin_notices', array( $this, 'notification' ) ); add_action( 'wp_ajax_njt_yaycommerce_dismiss', array( $this, 'ajax_dismiss_plugin' ) ); } public function ajax_dismiss_plugin() { check_ajax_referer( 'install-plugin_yaymail', 'nonce', true ); update_option( 'yaymail_noti_sale', 1 ); wp_send_json_success(); } public function notification() { if ( function_exists( 'get_current_screen' ) ) { $screen = get_current_screen(); if ( ! in_array( $screen->id, array( 'woocommerce_page_wc-settings', 'woocommerce_page_wc-addons' ) ) ) { return; } } else { return; } wp_enqueue_script( 'yaycommerce', NJFB_PLUGIN_URL . 'assets/js/yc.js', array(), NJFB_VERSION, true ); wp_localize_script( 'yaycommerce', 'yaycommerce', array( 'nonce' => $this->nonce, ) ); ?>