Changeset 53891 for trunk/src/wp-includes/class-wp-query.php
- Timestamp:
- 08/13/2022 10:29:19 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-query.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r53827 r53891 793 793 } 794 794 795 $qv['page_id'] = absint( $qv['page_id'] );796 $qv['year'] = absint( $qv['year'] );797 $qv['monthnum'] = absint( $qv['monthnum'] );798 $qv['day'] = absint( $qv['day'] );799 $qv['w'] = absint( $qv['w'] );795 $qv['page_id'] = is_scalar( $qv['page_id'] ) ? absint( $qv['page_id'] ) : 0; 796 $qv['year'] = is_scalar( $qv['year'] ) ? absint( $qv['year'] ) : 0; 797 $qv['monthnum'] = is_scalar( $qv['monthnum'] ) ? absint( $qv['monthnum'] ) : 0; 798 $qv['day'] = is_scalar( $qv['day'] ) ? absint( $qv['day'] ) : 0; 799 $qv['w'] = is_scalar( $qv['w'] ) ? absint( $qv['w'] ) : 0; 800 800 $qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : ''; 801 $qv['paged'] = absint( $qv['paged'] ); 802 $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // Comma-separated list of positive or negative integers. 803 $qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // Comma-separated list of positive or negative integers. 804 $qv['pagename'] = trim( $qv['pagename'] ); 805 $qv['name'] = trim( $qv['name'] ); 806 $qv['title'] = trim( $qv['title'] ); 807 if ( '' !== $qv['hour'] ) { 801 $qv['paged'] = is_scalar( $qv['paged'] ) ? absint( $qv['paged'] ) : 0; 802 $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // Array or comma-separated list of positive or negative integers. 803 $qv['author'] = is_scalar( $qv['author'] ) ? preg_replace( '|[^0-9,-]|', '', $qv['author'] ) : ''; // Comma-separated list of positive or negative integers. 804 $qv['pagename'] = is_scalar( $qv['pagename'] ) ? trim( $qv['pagename'] ) : ''; 805 $qv['name'] = is_scalar( $qv['name'] ) ? trim( $qv['name'] ) : ''; 806 $qv['title'] = is_scalar( $qv['title'] ) ? trim( $qv['title'] ) : ''; 807 808 if ( is_scalar( $qv['hour'] ) && '' !== $qv['hour'] ) { 808 809 $qv['hour'] = absint( $qv['hour'] ); 809 } 810 if ( '' !== $qv['minute'] ) { 810 } else { 811 $qv['hour'] = ''; 812 } 813 814 if ( is_scalar( $qv['minute'] ) && '' !== $qv['minute'] ) { 811 815 $qv['minute'] = absint( $qv['minute'] ); 812 } 813 if ( '' !== $qv['second'] ) { 816 } else { 817 $qv['minute'] = ''; 818 } 819 820 if ( is_scalar( $qv['second'] ) && '' !== $qv['second'] ) { 814 821 $qv['second'] = absint( $qv['second'] ); 815 } 816 if ( '' !== $qv['menu_order'] ) { 822 } else { 823 $qv['second'] = ''; 824 } 825 826 if ( is_scalar( $qv['menu_order'] ) && '' !== $qv['menu_order'] ) { 817 827 $qv['menu_order'] = absint( $qv['menu_order'] ); 828 } else { 829 $qv['menu_order'] = ''; 818 830 } 819 831 … … 824 836 825 837 // Compat. Map subpost to attachment. 826 if ( '' != $qv['subpost'] ) {838 if ( is_scalar( $qv['subpost'] ) && '' != $qv['subpost'] ) { 827 839 $qv['attachment'] = $qv['subpost']; 828 840 } 829 if ( '' != $qv['subpost_id'] ) {841 if ( is_scalar( $qv['subpost_id'] ) && '' != $qv['subpost_id'] ) { 830 842 $qv['attachment_id'] = $qv['subpost_id']; 831 843 } 832 844 833 $qv['attachment_id'] = absint( $qv['attachment_id'] );845 $qv['attachment_id'] = is_scalar( $qv['attachment_id'] ) ? absint( $qv['attachment_id'] ) : 0; 834 846 835 847 if ( ( '' !== $qv['attachment'] ) || ! empty( $qv['attachment_id'] ) ) {
Note: See TracChangeset
for help on using the changeset viewer.