Make WordPress Core


Ignore:
Timestamp:
03/07/2007 05:29:15 AM (19 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/query.php

    r4956 r4990  
    3030        global $wp_query;
    3131
    32         return ( $wp_query->is_admin || strstr($_SERVER['REQUEST_URI'], 'wp-admin/') );
     32        return ($wp_query->is_admin || (strpos($_SERVER['REQUEST_URI'], 'wp-admin/') !== false));
    3333}
    3434
     
    511511                                $this->is_category = false;
    512512                        } else {
    513                                 if (stristr($qv['cat'],'-')) {
     513                                if (strpos($qv['cat'], '-') !== false) {
    514514                                        $this->is_category = false;
    515515                                } else {
     
    558558                }
    559559
    560                 if (strstr($_SERVER['PHP_SELF'], 'wp-admin/')) {
     560                if (strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {
    561561                        $this->is_admin = true;
    562562                }
     
    851851                        foreach ( $cat_array as $cat ) {
    852852                                $cat = intval($cat);
    853                                 $in = strstr($cat, '-') ? false : true;
     853                                $in = (strpos($cat, '-') !== false) ? false : true;
    854854                                $cat = trim($cat, '-');
    855855                                if ( $in )
     
    919919                        $q['author'] = ''.urldecode($q['author']).'';
    920920                        $q['author'] = addslashes_gpc($q['author']);
    921                         if (stristr($q['author'], '-')) {
     921                        if (strpos($q['author'], '-') !== false) {
    922922                                $eq = '!=';
    923923                                $andor = 'AND';
     
    939939
    940940                if ('' != $q['author_name']) {
    941                         if (stristr($q['author_name'],'/')) {
     941                        if (strpos($q['author_name'], '/') !== false) {
    942942                                $q['author_name'] = explode('/',$q['author_name']);
    943943                                if ($q['author_name'][count($q['author_name'])-1]) {
Note: See TracChangeset for help on using the changeset viewer.