WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/07/2007 05:29:15 AM (14 years ago)
Author:
markjaquith
Message:

Use strpos instead of strstr where ever possible, for speed. Props rob1n. fixes #3920

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r4772 r4990  
    923923        if ($oldfile == 'index.php') { // Check to make sure it's not a new index
    924924            $index = implode('', file("$oldpath/$oldfile"));
    925             if ( strstr( $index, 'WP_USE_THEMES' ) ) {
     925            if (strpos($index, 'WP_USE_THEMES') !== false) {
    926926                if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
    927927                    return false;
     
    995995
    996996        foreach ($stylelines as $line) {
    997             if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
    998             elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
    999             elseif (strstr($line, "Description:")) $line = "Description: Your theme";
    1000             elseif (strstr($line, "Version:")) $line = "Version: 1";
    1001             elseif (strstr($line, "Author:")) $line = "Author: You";
    1002             fwrite($f, "{$line}\n");
     997            if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
     998            elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
     999            elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
     1000            elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
     1001            elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
     1002            fwrite($f, $line . "\n");
    10031003        }
    10041004        fclose($f);
Note: See TracChangeset for help on using the changeset viewer.