Make WordPress Core

Changeset 2568


Ignore:
Timestamp:
04/21/2005 01:35:52 AM (20 years ago)
Author:
ryan
Message:

Handle theme name collisions more elegantly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2560 r2568  
    15941594        if (empty($template_dir)) $template_dir = '/';
    15951595        if (empty($stylesheet_dir)) $stylesheet_dir = '/';
     1596
     1597        // Check for theme name collision.  This occurs if a theme is copied to
     1598        // a new theme directory and the theme header is not updated.  Whichever
     1599        // theme is first keeps the name.  Subsequent themes get a suffix applied.
     1600        // The Default and Classic themes always trump their pretenders.
     1601        if ( isset($themes[$name]) ) {
     1602            if ( ('WordPress Default' == $name || 'WordPress Classic' == $name) &&
     1603                     ('default' == $stylesheet || 'classic' == $stylesheet) ) {
     1604                // If another theme has claimed to be one of our default themes, move
     1605                // them aside.
     1606                $suffix = $themes[$name]['Stylesheet'];
     1607                $new_name = "$name/$suffix";
     1608                $themes[$new_name] = $themes[$name];
     1609                $themes[$new_name]['Name'] = $new_name;
     1610            } else {
     1611                $name = "$name/$stylesheet";
     1612            }
     1613        }
    15961614       
    15971615        $themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status']);
     
    16331651    $current_template = get_settings('template');
    16341652    $current_stylesheet = get_settings('stylesheet');
    1635     $current_theme = 'Default';
     1653    $current_theme = 'WordPress Default';
    16361654
    16371655    if ($themes) {
     
    16401658                    $themes[$theme_name]['Template'] == $current_template) {
    16411659                $current_theme = $themes[$theme_name]['Name'];
     1660                break;
    16421661            }
    16431662        }
Note: See TracChangeset for help on using the changeset viewer.