Ticket #17673: 17673.diff

File 17673.diff, 7.9 KB (added by solarissmoke, 2 years ago)
  • wp-includes/link-template.php

     
    10651065 * @since 1.5.0 
    10661066 * 
    10671067 * @param bool $in_same_cat Optional. Whether post should be in same category. 
    1068  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1068 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    10691069 * @return mixed Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists. 
    10701070 */ 
    10711071function get_previous_post($in_same_cat = false, $excluded_categories = '') { 
     
    10781078 * @since 1.5.0 
    10791079 * 
    10801080 * @param bool $in_same_cat Optional. Whether post should be in same category. 
    1081  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1081 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    10821082 * @return mixed Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists. 
    10831083 */ 
    10841084function get_next_post($in_same_cat = false, $excluded_categories = '') { 
     
    10931093 * @since 2.5.0 
    10941094 * 
    10951095 * @param bool $in_same_cat Optional. Whether post should be in same category. 
    1096  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1096 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    10971097 * @param bool $previous Optional. Whether to retrieve previous post. 
    10981098 * @return mixed Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists. 
    10991099 */ 
     
    11071107 
    11081108        $join = ''; 
    11091109        $posts_in_ex_cats_sql = ''; 
    1110         if ( $in_same_cat || !empty($excluded_categories) ) { 
     1110        if ( $in_same_cat || ! empty( $excluded_categories ) ) { 
    11111111                $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; 
    11121112 
    11131113                if ( $in_same_cat ) { 
     
    11161116                } 
    11171117 
    11181118                $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'"; 
    1119                 if ( !empty($excluded_categories) ) { 
    1120                         $excluded_categories = array_map('intval', explode(' and ', $excluded_categories)); 
    1121                         if ( !empty($cat_array) ) { 
     1119                if ( ! empty( $excluded_categories ) ) { 
     1120                        // back-compat, $excluded_categories used to be IDs separated by " and " 
     1121                        if( strpos( $excluded_categories, ' and ' ) !== false ) 
     1122                                $excluded_categories = explode( ' and ', $excluded_categories ); 
     1123                        else  
     1124                                $excluded_categories = explode( ',', $excluded_categories ); 
     1125                         
     1126                        $excluded_categories = array_map( 'intval', $excluded_categories ); 
     1127                                 
     1128                        if ( ! empty( $cat_array ) ) { 
    11221129                                $excluded_categories = array_diff($excluded_categories, $cat_array); 
    11231130                                $posts_in_ex_cats_sql = ''; 
    11241131                        } 
     
    11601167 * 
    11611168 * @param string $title Optional. Link title format. 
    11621169 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1163  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1170 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    11641171 * @param bool $previous Optional, default is true. Whether display link to previous post. 
    11651172 * @return string 
    11661173 */ 
     
    11971204 * 
    11981205 * @param string $title Optional. Link title format. 
    11991206 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1200  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1207 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    12011208 */ 
    12021209function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 
    12031210        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true); 
     
    12241231 * 
    12251232 * @param string $title Optional. Link title format. 
    12261233 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1227  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1234 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    12281235 */ 
    12291236function next_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 
    12301237        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false); 
     
    12371244 * 
    12381245 * @param string $title Optional. Link title format. 
    12391246 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1240  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1247 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    12411248 */ 
    12421249function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 
    12431250        echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true); 
     
    12521259 * @since 2.8.0 
    12531260 * 
    12541261 * @param bool $in_same_cat Optional. Whether returned post should be in same category. 
    1255  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1262 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    12561263 * @param bool $start Optional. Whether to retrieve first or last post. 
    12571264 * @return object 
    12581265 */ 
     
    12981305 * 
    12991306 * @param string $title Optional. Link title format. 
    13001307 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1301  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1308 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    13021309 * @param bool $start Optional, default is true. Whether display link to first or last post. 
    13031310 * @return string 
    13041311 */ 
     
    13351342 * 
    13361343 * @param string $title Optional. Link title format. 
    13371344 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1338  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1345 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    13391346 */ 
    13401347function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 
    13411348        echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); 
     
    14071414 * @param string $format Optional. Link anchor format. 
    14081415 * @param string $link Optional. Link permalink format. 
    14091416 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1410  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1417 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    14111418 */ 
    14121419function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    14131420        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true); 
     
    14211428 * @param string $format Optional. Link anchor format. 
    14221429 * @param string $link Optional. Link permalink format. 
    14231430 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1424  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1431 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    14251432 */ 
    14261433function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    14271434        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false); 
     
    14371444 * @param string $format Link anchor format. 
    14381445 * @param string $link Link permalink format. 
    14391446 * @param bool $in_same_cat Optional. Whether link should be in same category. 
    1440  * @param string $excluded_categories Optional. Excluded categories IDs. 
     1447 * @param string $excluded_categories Optional. Comma-separated list of excluded category IDs. 
    14411448 * @param bool $previous Optional, default is true. Whether display link to previous post. 
    14421449 */ 
    14431450function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {