offset = strtotime( '-7 days' ); add_action( 'admin_init', array( $this, 'checkInstallationDate' ) ); add_action( 'wp_ajax_' . self::DISMISS_AJAX_ACTION, array( $this, 'dismissNotice' ) ); add_action( 'admin_head', array( $this, 'loadStyle' ) ); add_action( 'admin_footer', array( $this, 'printDismissJS' ) ); } /** * Check if is possible to display admin notice on the current screen * * @return bool */ private function allowDisplay() { $currentScreen = get_current_screen(); if ( ! empty( $currentScreen ) && ( in_array( $currentScreen->base, array( 'dashboard', 'post', 'edit' ) ) || strpos( $currentScreen->base, DGWT_WCAS_SETTINGS_KEY ) !== false ) ) { return true; } return false; } /** * Display feedback notice * * @return void */ public function displayNotice() { global $current_user; if ( $this->allowDisplay() && ! dgoraAsfwFs()->is_premium() ) { ?>
' . $current_user->display_name . '', '' . DGWT_WCAS_NAME . '' ); ?>
', '' ); ?>
offset >= $install_date && current_user_can( 'install_plugins' ) ) { add_action( 'admin_notices', array( $this, 'displayNotice' ) ); } } } /** * Hide admin notice * * @return void */ public function dismissNotice() { if ( ! current_user_can( Helpers::shopManagerHasAccess() ? 'manage_woocommerce' : 'manage_options' ) ) { wp_die( - 1, 403 ); } check_ajax_referer( 'dgwt_wcas_dismiss_feedback_notice' ); update_option( self::HIDE_NOTICE_OPT, true ); wp_send_json_success(); } /** * Print JS for close admin notice * * @return void */ public function printDismissJS() { if ( ! $this->allowDisplay() ) { return; } ?> allowDisplay() ) { wp_enqueue_style( 'dgwt-wcas-admin-style' ); } } }