Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/18/2011 10:43:22 PM (13 years ago)
Author:
djpaul
Message:

Add oembed support to activity stream items and forum posts. Fixes #2707, massive props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r4678 r4709  
    1919function bp_get_option( $option_name, $default = '' ) {
    2020    $value = get_blog_option( bp_get_root_blog_id(), $option_name, $default );
    21    
     21
    2222    return apply_filters( 'bp_get_option', $value );
    2323}
     
    7979function bp_core_get_page_meta() {
    8080    $page_ids = bp_get_option( 'bp-pages' );
    81  
     81
    8282    // Upgrading from an earlier version of BP pre-1.3
    83     if ( !isset( $page_ids['members'] ) && $ms_page_ids = get_site_option( 'bp-pages' ) ) { 
     83    if ( !isset( $page_ids['members'] ) && $ms_page_ids = get_site_option( 'bp-pages' ) ) {
    8484        $page_blog_id = bp_is_multiblog_mode() ? get_current_blog_id() : bp_get_root_blog_id();
    8585
     
    9090        }
    9191    }
    92    
     92
    9393    return apply_filters( 'bp_core_get_page_meta', $page_ids );
    9494}
     
    698698function bp_core_record_activity() {
    699699    global $bp;
    700    
     700
    701701    if ( !is_user_logged_in() )
    702702        return false;
    703    
     703
    704704    $user_id = $bp->loggedin_user->id;
    705    
     705
    706706    if ( bp_core_is_user_spammer( $user_id ) || bp_core_is_user_deleted( $user_id ) )
    707707        return false;
     
    912912}
    913913add_action( 'bp_init', 'bp_core_add_ajax_hook' );
     914
     915/**
     916 * Initializes {@link BP_Embed} after everything is loaded.
     917 *
     918 * @global object $bp BuddyPress global settings
     919 * @package BuddyPress Core
     920 * @since 1.3
     921 */
     922function bp_embed_init() {
     923    global $bp;
     924
     925    if ( empty( $bp->embed ) )
     926        $bp->embed = new BP_Embed();
     927}
     928add_action( 'bp_init', 'bp_embed_init' );
    914929
    915930/**
     
    10751090 */
    10761091function bp_is_root_blog( $blog_id = 0 ) {
    1077    
    10781092    // Assume false
    10791093    $is_root_blog = false;
     
    11191133
    11201134        define( 'BP_ROOT_BLOG', $root_blog_id );
    1121        
     1135
    11221136    // Root blog is defined
    11231137    } else {
     
    12211235 *
    12221236 * @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter
    1223  * @return bool False when compatibility mode is disabled (default); true when enabled 
     1237 * @return bool False when compatibility mode is disabled (default); true when enabled
    12241238 */
    12251239function bp_is_username_compatibility_mode() {
     
    12321246 * Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WP Multisite. "Multiblog" is
    12331247 * a BP setup that allows BP content to be viewed in the theme, and with the URL, of every blog
    1234  * on the network. Thus, instead of having all 'boonebgorges' links go to 
     1248 * on the network. Thus, instead of having all 'boonebgorges' links go to
    12351249 *   http://example.com/members/boonebgorges
    12361250 * on the root blog, each blog will have its own version of the same profile content, eg
     
    12451259 *
    12461260 * @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter
    1247  * @return bool False when multiblog mode is disabled (default); true when enabled 
     1261 * @return bool False when multiblog mode is disabled (default); true when enabled
    12481262 */
    12491263function bp_is_multiblog_mode() {
     
    12641278 *
    12651279 * @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter
    1266  * @return bool False when WP Admin Bar support is disabled (default); true when enabled 
     1280 * @return bool False when WP Admin Bar support is disabled (default); true when enabled
    12671281 */
    12681282function bp_use_wp_admin_bar() {
    12691283    return apply_filters( 'bp_use_wp_admin_bar', defined( 'BP_USE_WP_ADMIN_BAR' ) && BP_USE_WP_ADMIN_BAR );
     1284}
     1285
     1286/**
     1287 * Are oembeds allowed in activity items?
     1288 *
     1289 * @return bool False when activity embed support is disabled; true when enabled (default)
     1290 * @since 1.3
     1291 */
     1292function bp_use_embed_in_activity() {
     1293    return apply_filters( 'bp_use_oembed_in_activity', !defined( 'BP_EMBED_DISABLE_ACTIVITY' ) || !BP_EMBED_DISABLE_ACTIVITY );
     1294}
     1295
     1296/**
     1297 * Are oembeds allwoed in acitivity replies?
     1298 *
     1299 * @return bool False when activity replies embed support is disabled; true when enabled (default)
     1300 * @since 1.3
     1301 */
     1302function bp_use_embed_in_activity_replies() {
     1303    return apply_filters( 'bp_use_embed_in_activity_replies', !defined( 'BP_EMBED_DISABLE_ACTIVITY_REPLIES' ) || !BP_EMBED_DISABLE_ACTIVITY_REPLIES );
     1304}
     1305
     1306/**
     1307 * Are oembeds allowed on forum posts?
     1308 *
     1309 * @return bool False when form post embed support is disabled; true when enabled (default)
     1310 * @since 1.3
     1311 */
     1312function bp_use_embed_in_forum_posts() {
     1313    return apply_filters( 'bp_use_embed_in_forum_posts', !defined( 'BP_EMBED_DISABLE_FORUM_POSTS' ) || !BP_EMBED_DISABLE_FORUM_POSTS );
    12701314}
    12711315
     
    13731417    do_action( 'bp_do_404', $redirect );
    13741418
    1375     $wp_query->set_404(); 
    1376     status_header( 404 ); 
     1419    $wp_query->set_404();
     1420    status_header( 404 );
    13771421    nocache_headers();
    13781422
Note: See TracChangeset for help on using the changeset viewer.