Advanced Woo Labels PRO' ); $notice_message = ''; $notice_id = ''; foreach ( $integrations as $integration ) { if ( ! $hide_option || array_search( $integration['id'], $hide_option ) === false ) { $notice_message .= '
  • ' . $integration['name'] . ' ' . __( 'Learn more', 'advanced-woo-labels' ) . '
  • '; $notice_id .= $integration['id'] . '|'; } } $notice_id = 'awl_hide_int_notices=' . urlencode( trim( $notice_id, '|' ) ); if ( $notice_message ) { $check_labels = $this->check_labels(); if ( $check_labels === 'false' ) { return; } $current_page_url = function_exists('wc_get_current_admin_url') ? wc_get_current_admin_url() : esc_url( admin_url('edit.php?post_type=awl-labels')); $dismiss_link = strpos( $current_page_url, '?' ) === false ? $current_page_url . '?' : $current_page_url . '&'; $html = ''; $html .= '
    '; $html .= ''; $html .= '
    '; $html .= '

    Advanced Woo Labels: ' . __( 'Integrations for your plugins', 'advanced-woo-labels' ) . '

    '; $html .= '

    ' . $notice_top_message. '

    '; $html .= ''; $html .= '' . __( 'All PRO Features', 'advanced-woo-labels' ) . '  ' . __( 'View Pricing', 'advanced-woo-labels' ) . ''; $html .= '
    '; $html .= ''; $html .= '
    '; $html .= '
    '; echo $html; } } /* * Add welcome notice */ public function display_welcome_header() { $screen = get_current_screen(); if ( ! $screen || $screen->id !== 'edit-awl-labels' ) { return; } $labels = AWL_Helpers::get_awl_labels( array( 'post_status' => 'any', 'suppress_filters' => true ) ); if ( $labels && count( $labels ) > 0 ) { return; } echo AWL_Admin_Meta_Boxes::get_welcome_notice(); } /* * Hide admin notices */ public function hide_notices() { if ( isset( $_GET['awl_hide_int_notices'] ) && $_GET['awl_hide_int_notices'] ) { $option = strpos( $_GET['awl_hide_int_notices'], '|' ) !== false ? explode('|', $_GET['awl_hide_int_notices'] ) : array( $_GET['awl_hide_int_notices'] ); $option_current = get_option( 'awl_hide_int_notices' ); $option = $option_current ? array_merge( $option_current, $option ) : $option; update_option( 'awl_hide_int_notices', $option, false ); } } /* * Check if user create any label and its is older then 1 week */ private function check_labels() { $show_notice_trans = get_transient( 'aws_labels_date_notices' ); if ( $show_notice_trans ) { return $show_notice_trans; } $show_notice = 'false'; $labels = get_posts( array( 'post_type' => 'awl-labels', 'post_status' => 'publish', 'posts_per_page' => 1, 'orderby' => 'date', 'order' => 'ASC', ) ); if ( $labels && count( $labels ) > 0 ) { $time_pass = time() - get_the_time('U', $labels[0]->ID ); $days_pass = (int) round((($time_pass/24)/60)/60); if ( $days_pass && $days_pass > 7 ) { $show_notice = 'true'; } } set_transient( 'aws_labels_date_notices', $show_notice, 60 * 60 * 24 ); return $show_notice; } } endif; add_action( 'init', 'AWL_Admin_Notices::instance' );