| 1353 | case 'post-thumbnails': |
| 1354 | // A boolean 3rd param may be added to set if the value passed |
| 1355 | // should stomp the previous setting or be treated as additive (merge). |
| 1356 | // It defaults to merging the new values with old. |
| 1357 | $current = get_theme_support( 'post-thumbnails' ); |
| 1358 | if ( $args === true ) { |
| 1359 | $stomp = true; |
| 1360 | } |
| 1361 | else { |
| 1362 | $_args = func_get_args(); |
| 1363 | if ( count( $_args ) == 3 ) { |
| 1364 | $stomp = (bool) $_args[2]; |
| 1365 | } |
| 1366 | else { |
| 1367 | $stomp = false; |
| 1368 | } |
| 1369 | } |
| 1370 | if ( !$stomp ) { |
| 1371 | // currently enabled for some post types, merge |
| 1372 | if ( is_array( $current ) && is_array( $current[0] ) ) { |
| 1373 | if ( is_string( $args[0] ) ) { |
| 1374 | $args[0] = array( $args[0] ); |
| 1375 | } |
| 1376 | $args[0] = array_unique( array_merge( $current[0], $args[0] ) ); |
| 1377 | } |
| 1378 | // currently enabled for all post types, keep as is |
| 1379 | else if ( $current ) { |
| 1380 | $args = true; |
| 1381 | } |
| 1382 | // else disabled for all post types, allow stomp below |
| 1383 | } |
| 1384 | break; |