status report overrides table format
New tr for every extension being checked for overrides.
This commit is contained in:
parent
c63b57c761
commit
27a7dd0255
|
@ -444,59 +444,61 @@
|
|||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
$template_paths = apply_filters( 'woocommerce_template_overrides_scan_paths', array( 'WooCommerce' => WC()->plugin_path() . '/templates/' ) );
|
||||
$scanned_files = array();
|
||||
$found_files = array();
|
||||
$template_paths = apply_filters( 'woocommerce_template_overrides_scan_paths', array( 'WooCommerce' => WC()->plugin_path() . '/templates/' ) );
|
||||
$scanned_files = array();
|
||||
$found_files = array();
|
||||
|
||||
foreach ( $template_paths as $plugin_name => $template_path ) {
|
||||
$scanned_files[ $plugin_name ] = WC_Admin_Status::scan_template_files( $template_path );
|
||||
}
|
||||
foreach ( $template_paths as $plugin_name => $template_path ) {
|
||||
$scanned_files[ $plugin_name ] = WC_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() . '/woocommerce/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
|
||||
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
|
||||
$theme_file = get_template_directory() . '/' . $file;
|
||||
} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
|
||||
$theme_file = get_template_directory() . '/woocommerce/' . $file;
|
||||
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() . '/woocommerce/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
|
||||
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
|
||||
$theme_file = get_template_directory() . '/' . $file;
|
||||
} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
|
||||
$theme_file = get_template_directory() . '/woocommerce/' . $file;
|
||||
} else {
|
||||
$theme_file = false;
|
||||
}
|
||||
|
||||
if ( $theme_file ) {
|
||||
$core_version = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file );
|
||||
$theme_version = WC_Admin_Status::get_file_version( $theme_file );
|
||||
|
||||
if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) {
|
||||
$found_files[ $plugin_name ][] = sprintf( __( '<code>%s</code> version <strong style="color:red">%s</strong> is out of date. The core version is %s', 'woocommerce' ), basename( $theme_file ), $theme_version ? $theme_version : '-', $core_version );
|
||||
} else {
|
||||
$theme_file = false;
|
||||
}
|
||||
|
||||
if ( $theme_file ) {
|
||||
$core_version = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $file );
|
||||
$theme_version = WC_Admin_Status::get_file_version( $theme_file );
|
||||
|
||||
if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) {
|
||||
$found_files[ $plugin_name ][] = sprintf( __( '<code>%s</code> version <strong style="color:red">%s</strong> is out of date. The core version is %s', 'woocommerce' ), basename( $theme_file ), $theme_version ? $theme_version : '-', $core_version );
|
||||
} else {
|
||||
$found_files[ $plugin_name ][] = sprintf( '<code>%s</code>', basename( $theme_file ) );
|
||||
}
|
||||
$found_files[ $plugin_name ][] = sprintf( '<code>%s</code>', basename( $theme_file ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $found_files ) {
|
||||
foreach ( $found_files as $plugin_name => $found_plugin_files ) {
|
||||
?>
|
||||
if ( $found_files ) {
|
||||
foreach ( $found_files as $plugin_name => $found_plugin_files ) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php _e( 'Template Overrides', 'woocommerce' ); ?> (<?php echo $plugin_name; ?>):</td>
|
||||
<td><?php echo implode( ', <br/>', $found_plugin_files ); ?></td>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<td><?php _e( 'Template Overrides', 'woocommerce' ); ?>:</td>
|
||||
<td><?php _e( 'No overrides present in theme.', 'woocommerce' ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php _e( 'Template Overrides', 'woocommerce' ); ?>:</td>
|
||||
<td><?php _e( 'No overrides present in theme.', 'woocommerce' ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue