Changeset 9188
- Timestamp:
- 11/26/2014 06:09:42 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-template.php
r9187 r9188 1999 1999 * Enable oEmbed support for Messages. 2000 2000 * 2001 * There's no caching as BP 1.5 does not have a Messages meta API.2002 *2003 2001 * @since BuddyPress (1.5.0) 2004 2002 * 2005 2003 * @see BP_Embed 2006 *2007 * @todo Add Messages meta?2008 2004 */ 2009 2005 function bp_messages_embed() { 2010 add_filter( 'embed_post_id', 'bp_get_the_thread_message_id' ); 2006 add_filter( 'embed_post_id', 'bp_get_the_thread_message_id' ); 2007 add_filter( 'bp_embed_get_cache', 'bp_embed_message_cache', 10, 3 ); 2008 add_action( 'bp_embed_update_cache', 'bp_embed_message_save_cache', 10, 3 ); 2011 2009 } 2012 2010 add_action( 'thread_loop_start', 'bp_messages_embed' ); 2011 2012 /** 2013 * Fetch a private message item's cached embeds. 2014 * 2015 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_messages_embed()}. 2016 * 2017 * @since BuddyPress (2.2.0) 2018 * 2019 * @param string $cache An empty string passed by BP_Embed::parse_oembed() for 2020 * functions like this one to filter. 2021 * @param int $id The ID of the message item. 2022 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed(). 2023 * @return mixed The cached embeds for this message item. 2024 */ 2025 function bp_embed_message_cache( $cache, $id, $cachekey ) { 2026 return bp_messages_get_meta( $id, $cachekey ); 2027 } 2028 2029 /** 2030 * Set a private message item's embed cache. 2031 * 2032 * Used during {@link BP_Embed::parse_oembed()} via {@link bp_messages_embed()}. 2033 * 2034 * @since BuddyPress (2.2.0) 2035 * 2036 * @param string $cache An empty string passed by BP_Embed::parse_oembed() for 2037 * functions like this one to filter. 2038 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed(). 2039 * @param int $id The ID of the message item. 2040 * @return bool True on success, false on failure. 2041 */ 2042 function bp_embed_message_save_cache( $cache, $cachekey, $id ) { 2043 bp_messages_update_meta( $id, $cachekey, $cache ); 2044 }
Note: See TracChangeset
for help on using the changeset viewer.