?>
</a></p>
	</div>
</div>

<?php 
} else {
    ?>

		<h2 class="nav-tab-wrapper">
			<?php 
    $tabs = array('status' => __('Status', 'tl-template-checker'), 'diff' => __('Diff', 'tl-template-checker'));
    foreach ($tabs as $name => $label) {
        printf('<a href="%s" class="nav-tab %s">%s</a>', esc_url(admin_url('admin.php?page=tplc-status&amp;tab=' . $name)), $current_tab == $name ? 'nav-tab-active' : '', $label);
    }
    ?>
		</h2><br/>
		<?php 
    switch ($current_tab) {
        case "diff":
            TPLC_Admin_Status::status_diff();
            break;
        default:
            TPLC_Admin_Status::status_report();
            break;
    }
    ?>
	</div>

<?php 
}
foreach ($scanned_files as $plugin_name => $files) {
    foreach ($files as $file) {
        // skip if no php file
        if (!strpos($file, '.php')) {
            continue;
        }
        $child_path = get_stylesheet_directory() . '/' . $file;
        // Exclude functions.php
        if (file_exists($child_path) && basename($file) !== 'functions.php') {
            $theme_file = $child_path;
        } else {
            $theme_file = false;
        }
        if ($theme_file) {
            $parent_version = TPLC_Admin_Status::get_file_version(get_template_directory() . '/' . $file);
            $child_version = TPLC_Admin_Status::get_file_version($theme_file);
            if ($parent_version && $child_version && version_compare($child_version, $parent_version, '<')) {
                $found_files[$plugin_name][] = sprintf(__('%s <code>%s</code>: Child theme version <strong style="color:red">%s</strong> is out of date. The parent theme version is <strong>%s</strong>.', 'tl-template-checker'), '<span class="dashicons dashicons-no-alt" style="color:red"></span>', basename($theme_file), $child_version ? $child_version : '-', $parent_version);
            } elseif (!$child_version && $parent_version) {
                $found_files[$plugin_name][] = sprintf(__('%s <code>%s</code>: Child theme is missing version keyword. The parent theme version is <strong>%s</strong>.', 'tl-template-checker'), '<span class="dashicons dashicons-info" style="color:orange"></span>', basename($theme_file), $parent_version);
            } elseif (!$parent_version) {
                $found_files[$plugin_name][] = sprintf(__('%s <code>%s</code>: Parent theme is missing version keyword.', 'tl-template-checker'), '<span class="dashicons dashicons-minus"></span>', basename($theme_file));
            } else {
                $found_files[$plugin_name][] = sprintf(__('%s <code>%s</code>: Child theme version <strong style="color:green">%s</strong> matches parent theme.', 'tl-template-checker'), '<span class="dashicons dashicons-yes" style="color:green"></span>', basename($theme_file), $child_version ? $child_version : '-', $parent_version);
            }
        }
    }
}
if ($found_files) {
    foreach ($found_files as $plugin_name => $found_plugin_files) {
        $theme = wp_get_theme();
 /**
  * Scan the template files
  *
  * @access public
  * @param string $template_path
  * @return array
  */
 public static function scan_template_files($template_path)
 {
     $files = scandir($template_path);
     $result = array();
     if ($files) {
         foreach ($files as $key => $value) {
             if (!in_array($value, array(".", ".."))) {
                 if (is_dir($template_path . DIRECTORY_SEPARATOR . $value)) {
                     $sub_files = TPLC_Admin_Status::scan_template_files($template_path . DIRECTORY_SEPARATOR . $value);
                     foreach ($sub_files as $sub_file) {
                         $result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
                     }
                 } else {
                     $result[] = $value;
                 }
             }
         }
     }
     return $result;
 }
 /**
  * Show a notice highlighting bad template files
  */
 public function template_file_check_notice()
 {
     require_once 'class-tplc-admin-status.php';
     $template_path = get_template_directory() . '/';
     $parent_theme_templates = TPLC_Admin_Status::scan_template_files($template_path);
     // TPLC_Admin_Status::scan_template_files( WC()->plugin_path() . '/templates' );
     $outdated = false;
     foreach ($parent_theme_templates as $file) {
         $theme_file = false;
         $child_path = get_stylesheet_directory() . '/' . $file;
         // Exclude functions.php
         if (file_exists($child_path) && basename($file) !== 'functions.php') {
             $theme_file = $child_path;
         } else {
             $theme_file = false;
         }
         if ($theme_file) {
             $parent_version = TPLC_Admin_Status::get_file_version(get_template_directory() . '/' . $file);
             $child_version = TPLC_Admin_Status::get_file_version($theme_file);
             if ($parent_version && $child_version && version_compare($child_version, $parent_version, '<')) {
                 $outdated = true;
                 break;
             }
         }
     }
     if ($outdated) {
         include 'views/html-notice-template-check.php';
     } else {
         self::remove_notice('template_files');
     }
 }