<?php
require_once dirname(__FILE__) . '/existing-calculators-list.php';
require_once dirname(__FILE__) . '/scc-diagnostic.php';
require_once dirname(__FILE__) . '/scc-settings-help-menu.php';
require_once dirname(__FILE__) . '/coupon.php';
require_once dirname(__FILE__) . '/quote-list-view.php';
require dirname( __FILE__ ) . '/tabs-init.php';

function scc_admin_hide_notices() {

  if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'edit_sccbyid' ) === false ) {
    return;
  }

  global $wp_filter;

  foreach ( array( 'user_admin_notices', 'admin_notices', 'all_admin_notices' ) as $notices_type ) {
    if ( empty( $wp_filter[ $notices_type ]->callbacks ) || ! is_array( $wp_filter[ $notices_type ]->callbacks ) ) {
      continue;
    }
    foreach ( $wp_filter[ $notices_type ]->callbacks as $priority => $hooks ) {
      foreach ( $hooks as $name => $arr ) {
        if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
          unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] );
          continue;
        }
        $class = ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) ? strtolower( get_class( $arr['function'][0] ) ) : '';
        if (
          ! empty( $class ) &&
          strpos( $class, 'scc' ) !== false
        ) {
          continue;
        }
        if (
          ! empty( $name ) && (
            strpos( $name, 'scc' ) === false
          )
        ) {
          unset( $wp_filter[ $notices_type ]->callbacks[ $priority ][ $name ] );
        }
      }
    }
  }
}
add_action( 'admin_print_scripts', 'scc_admin_hide_notices' );
?>