Make WordPress Core

Changeset 5848


Ignore:
Timestamp:
08/04/2007 04:30:27 PM (17 years ago)
Author:
markjaquith
Message:

Allow for hour/minute/second values in the QS that evaluate as false (like 0). Props Otto42 and agharbeia. fixes #4499

File:
1 edited

Legend:

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

    r5707 r5848  
    451451        $qv['w'] = (int) $qv['w'];
    452452        $qv['m'] =  (int) $qv['m'];
    453         if ( '' != $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
    454         if ( '' != $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
    455         if ( '' != $qv['second'] ) $qv['second'] = (int) $qv['second'];
     453        if ( '' !== $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
     454        if ( '' !== $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
     455        if ( '' !== $qv['second'] ) $qv['second'] = (int) $qv['second'];
    456456
    457457        // Compat.  Map subpost to attachment.
     
    470470        } elseif ( $qv['p'] ) {
    471471            $this->is_single = true;
    472         } elseif ( ('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) {
     472        } elseif ( ('' !== $qv['hour']) && ('' !== $qv['minute']) &&('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) {
    473473            // If year, month, day, hour, minute, and second are set, a single
    474474            // post is being queried.
     
    482482        // Look for archive queries.  Dates, categories, authors.
    483483
    484             if ( '' != $qv['second'] ) {
     484            if ( '' !== $qv['second'] ) {
    485485                $this->is_time = true;
    486486                $this->is_date = true;
    487487            }
    488488
    489             if ( '' != $qv['minute'] ) {
     489            if ( '' !== $qv['minute'] ) {
    490490                $this->is_time = true;
    491491                $this->is_date = true;
    492492            }
    493493
    494             if ( '' != $qv['hour'] ) {
     494            if ( '' !== $qv['hour'] ) {
    495495                $this->is_time = true;
    496496                $this->is_date = true;
     
    740740        }
    741741
    742         if ( '' != $q['hour'] )
     742        if ( '' !== $q['hour'] )
    743743            $where .= " AND HOUR(post_date)='" . $q['hour'] . "'";
    744744
    745         if ( '' != $q['minute'] )
     745        if ( '' !== $q['minute'] )
    746746            $where .= " AND MINUTE(post_date)='" . $q['minute'] . "'";
    747747
    748         if ( '' != $q['second'] )
     748        if ( '' !== $q['second'] )
    749749            $where .= " AND SECOND(post_date)='" . $q['second'] . "'";
    750750
Note: See TracChangeset for help on using the changeset viewer.