Make WordPress Core


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

    r4987 r4990  
    11441144                        $state = true;
    11451145                        foreach ( $markerdata as $n => $markerline ) {
    1146                                 if ( strstr( $markerline, "# BEGIN {$marker}" ))
     1146                                if (strpos($markerline, '# BEGIN ' . $marker) !== false)
    11471147                                        $state = false;
    11481148                                if ( $state ) {
     
    11521152                                                fwrite( $f, "{$markerline}" );
    11531153                                }
    1154                                 if ( strstr( $markerline, "# END {$marker}" ) ) {
     1154                                if (strpos($markerline, '# END ' . $marker) !== false) {
    11551155                                        fwrite( $f, "# BEGIN {$marker}\n" );
    11561156                                        if ( is_array( $insertion ))
     
    11901190                $state = false;
    11911191                foreach ( $markerdata as $markerline ) {
    1192                         if ( strstr( $markerline, "# END {$marker}" ))
     1192                        if (strpos($markerline, '# END ' . $marker) !== false)
    11931193                                $state = false;
    11941194                        if ( $state )
    11951195                                $result[] = $markerline;
    1196                         if ( strstr( $markerline, "# BEGIN {$marker}" ))
     1196                        if (strpos($markerline, '# BEGIN ' . $marker) !== false)
    11971197                                $state = true;
    11981198                }
     
    17671767                ';
    17681768}
    1769 if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ))
     1769
     1770if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
    17701771        add_action( 'admin_footer', 'browse_happy' );
    17711772
     
    19281929        $size = strtolower( ini_get( 'upload_max_filesize' ) );
    19291930        $bytes = 0;
    1930         if ( strstr( $size, 'k' ) )
     1931        if (strpos($size, 'k') !== false)
    19311932                $bytes = $size * 1024;
    1932         if ( strstr( $size, 'm' ) )
     1933        if (strpos($size, 'm') !== false)
    19331934                $bytes = $size * 1024 * 1024;
    1934         if ( strstr( $size, 'g' ) )
     1935        if (strpos($size, 'g') !== false)
    19351936                $bytes = $size * 1024 * 1024 * 1024;
    19361937?>
Note: See TracChangeset for help on using the changeset viewer.