Changeset 3447627
- Timestamp:
- 01/27/2026 08:49:04 AM (2 months ago)
- Location:
- molongui-authorship/trunk
- Files:
-
- 1 added
- 7 edited
-
README.txt (modified) (1 diff)
-
changelog.txt (modified) (1 diff)
-
common/utils/media.php (added)
-
common/utils/post.php (modified) (1 diff)
-
includes/author.php (modified) (6 diffs)
-
molongui-authorship.php (modified) (2 diffs)
-
views/author-box/related/html-layout-1.php (modified) (1 diff)
-
views/author-box/related/html-layout-2.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
molongui-authorship/trunk/README.txt
r3443140 r3447627 253 253 254 254 <strong>Important</strong>: If you use a caching plugin, please clear your cache after updating any plugins. 255 256 = 5.2.8 (2026-01-27) = 257 258 * **Fixed**: Related posts in the author box now include all relevant posts. 259 * **Changed**: Updated framework files to v3.4.2. 255 260 256 261 = 5.2.7 (2026-01-20) = -
molongui-authorship/trunk/changelog.txt
r3443140 r3447627 2 2 3 3 == Changelog == 4 5 = 5.2.8 (2026-01-27) = 6 7 * **Fixed**: Related posts in the author box now include all relevant posts. 8 * **Changed**: Updated framework files to v3.4.2. 4 9 5 10 = 5.2.7 (2026-01-20) = -
molongui-authorship/trunk/common/utils/post.php
r3443140 r3447627 359 359 return $fallback; 360 360 } 361 public static function sanitize_cat_query_args( $cat, $options = array() ) 362 { 363 $mode = isset( $options['mode'] ) ? strtolower( trim( (string) $options['mode'] ) ) : 'in'; 364 if ( $mode !== 'and' ) 365 { 366 $mode = 'in'; 367 } 368 369 $include = array(); 370 $exclude = array(); 371 if ( $cat === '' || $cat === null || $cat === false ) 372 { 373 return array(); 374 } 375 $tokens = array(); 376 377 if ( is_array( $cat ) ) 378 { 379 $tokens = $cat; 380 } 381 elseif ( is_string( $cat ) ) 382 { 383 $cat = trim( $cat ); 384 385 if ( $cat === '' ) 386 { 387 return array(); 388 } 389 $tokens = ( strpos( $cat, ',' ) !== false ) ? explode( ',', $cat ) : array( $cat ); 390 } 391 elseif ( is_int( $cat ) || is_float( $cat ) ) 392 { 393 $tokens = array( $cat ); 394 } 395 else 396 { 397 return array(); 398 } 399 foreach ( $tokens as $token ) 400 { 401 if ( is_int( $token ) || is_float( $token ) ) 402 { 403 $n = (int) $token; 404 } 405 elseif ( is_string( $token ) ) 406 { 407 $token = trim( $token ); 408 409 if ( $token === '' || ! is_numeric( $token ) ) 410 { 411 continue; 412 } 413 414 $n = (int) $token; 415 } 416 else 417 { 418 continue; 419 } 420 if ( $n === 0 ) 421 { 422 continue; 423 } 424 if ( $n < 0 ) 425 { 426 $exclude[] = absint( $n ); 427 } 428 else 429 { 430 $include[] = absint( $n ); 431 } 432 } 433 $include = array_values( array_unique( array_filter( $include ) ) ); 434 $exclude = array_values( array_unique( array_filter( $exclude ) ) ); 435 if ( empty( $include ) && empty( $exclude ) ) 436 { 437 return array(); 438 } 439 if ( count( $include ) === 1 && empty( $exclude ) ) 440 { 441 return array( 'cat' => (int) $include[0] ); 442 } 443 444 if ( count( $exclude ) === 1 && empty( $include ) ) 445 { 446 return array( 'cat' => -1 * (int) $exclude[0] ); 447 } 448 $out = array(); 449 450 if ( ! empty( $include ) ) 451 { 452 $out_key = ( $mode === 'and' ) ? 'category__and' : 'category__in'; 453 $out[ $out_key ] = $include; 454 } 455 456 if ( ! empty( $exclude ) ) 457 { 458 $out['category__not_in'] = $exclude; 459 } 460 461 return $out; 462 } 361 463 362 464 } // class -
molongui-authorship/trunk/includes/author.php
r3443140 r3447627 1232 1232 $defaults = array 1233 1233 ( 1234 'cat' => 0,1234 'cat' => '', 1235 1235 'fields' => 'all', 1236 1236 'ignore_sticky_posts' => true, … … 1289 1289 1290 1290 $posts_per_page = (int) $a['posts_per_page']; 1291 if ( $posts_per_page < -1 )1291 if ( $posts_per_page <= -1 ) 1292 1292 { 1293 1293 $posts_per_page = -1; … … 1300 1300 } 1301 1301 1302 $cat = $a['cat']; 1303 if ( $cat === '' || $cat === null ) 1304 { 1305 $cat = 0; 1306 } 1307 else 1308 { 1309 $cat = absint( $cat ); 1310 } 1302 $cat_args = Post::sanitize_cat_query_args( $a['cat'] ); 1311 1303 1312 1304 $post__in = $a['post__in']; // accept array|string|int. … … 1465 1457 'post__in' => $post__in, 1466 1458 'post__not_in' => $post__not_in, 1467 'cat' => $cat,1468 1459 'suppress_filters' => false, 1469 1460 'update_post_term_cache' => ( $fields === 'all' ), // if only IDs, don't waste time filling term cache 1470 1461 'update_post_meta_cache' => ( $fields === 'all' ), // if only IDs, skip meta cache 1471 1462 ); 1463 $q_args = array_merge( $q_args, $cat_args ); 1472 1464 1473 1465 /*! … … 1480 1472 */ 1481 1473 $q_args = apply_filters( 'molongui_authorship/author/get_posts/query_args', $q_args, $this ); 1482 1483 1474 $resolved = array 1484 1475 ( 1485 'cat' => $cat,1486 1476 'fields' => $fields, 1487 1477 'ignore_sticky_posts' => $ignore_sticky_posts, … … 1503 1493 'language' => $a['language'], 1504 1494 ); 1495 $resolved = array_merge( $resolved, $cat_args ); 1505 1496 1506 1497 /*! -
molongui-authorship/trunk/molongui-authorship.php
r3443140 r3447627 13 13 * Plugin URI: https://www.molongui.com/wordpress-plugin-post-authors 14 14 * Description: All-in-One Authorship Solution: Seamless Author Box, Guest Authors, and Co-Authors to enhance your site's authority, credibility, engagement, and SEO. 15 * Version: 5.2. 715 * Version: 5.2.8 16 16 * Requires at least: 5.2 17 17 * Tested up to: 6.9 … … 44 44 final class MolonguiAuthorship 45 45 { 46 const VERSION = '5.2. 7';46 const VERSION = '5.2.8'; 47 47 use Singleton; 48 48 function __construct() -
molongui-authorship/trunk/views/author-box/related/html-layout-1.php
r3443140 r3447627 5 5 $related_posts_ids = $profile->get_posts_ids( array 6 6 ( 7 'post_type' => 'related', 8 'post__not_in' => get_the_ID(), 7 'post_type' => 'related', 9 8 ) ); 10 9 -
molongui-authorship/trunk/views/author-box/related/html-layout-2.php
r3443140 r3447627 5 5 $related_posts_ids = $profile->get_posts_ids( array 6 6 ( 7 'post_type' => 'related', 8 'post__not_in' => get_the_ID(), 7 'post_type' => 'related', 9 8 ) ); 10 9
Note: See TracChangeset
for help on using the changeset viewer.