/** * Checks all templates overridden by the user to see if they need an update * * @param $dirs_to_scan The directories to scan * * @return array An array containing all the outdated template files found */ public function check_templates($dirs_to_scan) { $outdated_templates = array(); foreach ($dirs_to_scan as $dir => $title) { $template_finder = new CUAR_TemplateFinder($this); $template_finder->scan_directory($dir); $tmp = $template_finder->get_outdated_templates(); if (!empty($tmp)) { $outdated_templates[$title] = $tmp; } unset($template_finder); } return $outdated_templates; }
</div> <p> </p> <div id="sections_tabs" class="tab-container"> <ul class="tab-wrapper"> <?php foreach ($dirs_to_scan as $dir => $title) { printf('<li class="nav-tab"><a href="#section_tab_%1$s">%2$s</a></li>', sanitize_title($title), esc_html($title)); } ?> </ul> <?php foreach ($dirs_to_scan as $dir => $title) { $template_finder = new CUAR_TemplateFinder($this->plugin->get_template_engine()); $template_finder->scan_directory($dir); include_once CUAR_INCLUDES_DIR . '/core-addons/status/template-printer.class.php'; $template_printer = new CUAR_TemplatePrinter(); ?> <div id="section_tab_<?php echo esc_attr(sanitize_title($title)); ?> "> <h2><?php printf(__('%s: %d template(s)', 'cuar'), $title, $template_finder->get_template_count()); ?> </h2> <table class="widefat cuar-templates-table"> <?php $template_printer->print_template_headings();
_e('If you still do not have any version number in your template files, please paste the following line of ' . 'code as the first line of your template and make sure it is compatible with the the current template version.', 'cuar'); ?> </em></p> <pre><code><?php /** Template version: 1.0.0 */ ?></code></pre> <?php } ?> <ol> <?php $dirs_to_scan = apply_filters('cuar/core/status/directories-to-scan', array(CUAR_PLUGIN_DIR => __('WP Customer Area', 'cuar'))); foreach ($dirs_to_scan as $dir => $title) { $template_finder = new CUAR_TemplateFinder($this->plugin->get_template_engine()); $template_finder->scan_directory($dir); $outdated = $template_finder->get_outdated_templates(); if (empty($outdated)) { continue; } ?> <li> <h4><?php echo $title; ?> </h4> <ul> <?php foreach ($outdated as $name => $t) { ?>