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