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-includes/rewrite.php

    r4886 r4990  
    592592                //2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
    593593                //minute all present). Set these flags now as we need them for the endpoints.
    594                 if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
    595                         || strstr($struct, '%pagename%')
    596                         || (strstr($struct, '%year%') &&  strstr($struct, '%monthnum%') && strstr($struct, '%day%') && strstr($struct, '%hour%') && strstr($struct, '%minute') && strstr($struct, '%second%'))) {
     594                if (strpos($struct, '%postname%') !== false || strpos($struct, '%post_id%') !== false
     595                        || strpos($struct, '%pagename%') !== false
     596                        || (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)) {
    597597                    $post = true;
    598                     if  ( strstr($struct, '%pagename%') )
     598                    if (strpos($struct, '%pagename%') !== false)
    599599                        $page = true;
    600600                }
     
    810810                }
    811811
    812                 if (strstr($query, $this->index)) {
     812                if (strpos($query, $this->index) !== false) {
    813813                    $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
    814814                } else {
Note: See TracChangeset for help on using the changeset viewer.