Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Scan the theme directory for all UWP templates to see if our theme
- * overrides any of them.
- */
- $override_files = array();
- $outdated_templates = false;
- $scan_files = self::scan_template_files( USERSWP_PATH . 'templates/' );
- foreach ( $scan_files as $file ) {
- if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
- $theme_file = get_stylesheet_directory() . '/' . $file;
- } elseif ( file_exists( get_stylesheet_directory() . '/userswp/' . $file ) ) {
- $theme_file = get_stylesheet_directory() . '/userswp/' . $file;
- } elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
- $theme_file = get_template_directory() . '/' . $file;
- } elseif ( file_exists( get_template_directory() . '/userswp/' . $file ) ) {
- $theme_file = get_template_directory() . '/userswp/' . $file;
- } else {
- $theme_file = false;
- }
- if ( ! empty( $theme_file ) ) {
- $core_version = self::get_file_version( USERSWP_PATH . '/templates/' . $file );
- $theme_version = self::get_file_version( $theme_file );
- if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) {
- if ( ! $outdated_templates ) {
- $outdated_templates = true;
- }
- }
- $override_files[] = array(
- 'file' => str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file ),
- 'version' => $theme_version,
- 'core_version' => $core_version,
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement