Changeset 10834
- Timestamp:
- 05/31/2016 06:58:43 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r10825 r10834 1667 1667 */ 1668 1668 return apply_filters( 'bp_use_embed_in_private_messages', !defined( 'BP_EMBED_DISABLE_PRIVATE_MESSAGES' ) || !BP_EMBED_DISABLE_PRIVATE_MESSAGES ); 1669 } 1670 1671 /** 1672 * Extracts media metadata from a given content. 1673 * 1674 * @since 2.6.0 1675 * 1676 * @param string $content The content to check. 1677 * @param string|int $type The type to check. Can also use a bitmask. See the class constants in the 1678 * BP_Media_Extractor class for more info. 1679 * @return array|bool If media exists, will return array of media metadata. Else, boolean false. 1680 */ 1681 function bp_core_extract_media_from_content( $content = '', $type = 'all' ) { 1682 if ( is_string( $type ) ) { 1683 $class = new ReflectionClass( 'BP_Media_Extractor' ); 1684 $bitmask = $class->getConstant( strtoupper( $type ) ); 1685 } else { 1686 $bitmask = (int) $type; 1687 } 1688 1689 // Type isn't valid, so bail. 1690 if ( empty( $bitmask ) ) { 1691 return false; 1692 } 1693 1694 $x = new BP_Media_Extractor; 1695 $media = $x->extract( $content, $bitmask ); 1696 1697 unset( $media['has'] ); 1698 $retval = array_filter( $media ); 1699 1700 return ! empty( $retval ) ? $retval : false; 1669 1701 } 1670 1702
Note: See TracChangeset
for help on using the changeset viewer.