| @@ 544-551 (lines=8) @@ | ||
| 541 | $media = array_values( |
|
| 542 | array_filter( |
|
| 543 | $block['media'], |
|
| 544 | function ( $single ) { |
|
| 545 | // Only images and videos can be uploaded. |
|
| 546 | if ( 0 === strpos( $single['type'], 'image/' ) || 0 === strpos( $single['type'], 'video/' ) ) { |
|
| 547 | return true; |
|
| 548 | } |
|
| 549 | ||
| 550 | return false; |
|
| 551 | } |
|
| 552 | ) |
|
| 553 | ); |
|
| 554 | ||
| @@ 564-570 (lines=7) @@ | ||
| 561 | $filtered_media = array_values( |
|
| 562 | array_filter( |
|
| 563 | $media, |
|
| 564 | function ( $single ) { |
|
| 565 | if ( 0 === strpos( $single['type'], 'video/' ) || 'image/gif' === $single['type'] ) { |
|
| 566 | return false; |
|
| 567 | } |
|
| 568 | ||
| 569 | return true; |
|
| 570 | } |
|
| 571 | ) |
|
| 572 | ); |
|
| 573 | // We can only add the first four images found to the tweet. |
|