<tr> <th colspan="3" data-export-label="Templates"><?php _e('Templates', 'wp-club-manager'); echo ' <img class="help_tip" data-tip="' . esc_attr('This section shows any files that are overriding the default WP Club Manager template pages.', 'wp-club-manager') . '" src="' . WPCM()->plugin_url() . '/assets/images/help.png" height="16" width="16" />'; ?> </th> </tr> </thead> <tbody> <?php $template_paths = apply_filters('wpclubmanager_template_overrides_scan_paths', array('WP Club Manager' => WPCM()->plugin_path() . '/templates/')); $scanned_files = array(); $found_files = array(); $outdated_templates = false; foreach ($template_paths as $plugin_name => $template_path) { $scanned_files[$plugin_name] = WPCM_Admin_Status::scan_template_files($template_path); } foreach ($scanned_files as $plugin_name => $files) { foreach ($files as $file) { if (file_exists(get_stylesheet_directory() . '/' . $file)) { $theme_file = get_stylesheet_directory() . '/' . $file; } elseif (file_exists(get_stylesheet_directory() . '/wpclubmanager/' . $file)) { $theme_file = get_stylesheet_directory() . '/wpclubmanager/' . $file; } elseif (file_exists(get_template_directory() . '/' . $file)) { $theme_file = get_template_directory() . '/' . $file; } elseif (file_exists(get_template_directory() . '/wpclubmanager/' . $file)) { $theme_file = get_template_directory() . '/wpclubmanager/' . $file; } else { $theme_file = false; } if ($theme_file) {
/** * Show a notice highlighting bad template files */ public function template_file_check_notice() { $core_templates = WPCM_Admin_Status::scan_template_files(WPCM()->plugin_path() . '/templates'); $outdated = false; foreach ($core_templates as $file) { $theme_file = false; if (file_exists(get_stylesheet_directory() . '/' . $file)) { $theme_file = get_stylesheet_directory() . '/' . $file; } elseif (file_exists(get_stylesheet_directory() . '/wpclubmanager/' . $file)) { $theme_file = get_stylesheet_directory() . '/wpclubmanager/' . $file; } elseif (file_exists(get_template_directory() . '/' . $file)) { $theme_file = get_template_directory() . '/' . $file; } elseif (file_exists(get_template_directory() . '/wpclubmanager/' . $file)) { $theme_file = get_template_directory() . '/wpclubmanager/' . $file; } if ($theme_file) { $core_version = WPCM_Admin_Status::get_file_version(WPCM()->plugin_path() . '/templates/' . $file); $theme_version = WPCM_Admin_Status::get_file_version($theme_file); if ($core_version && $theme_version && version_compare($theme_version, $core_version, '<')) { $outdated = true; break; } } } if ($outdated) { include 'views/html-notice-template-check.php'; } else { self::remove_notice('template_files'); } }