/**
 * Set the strings for WP HeartBeat API where needed.
 *
 * @since 2.0.0
 *
 * @param array $strings Localized strings.
 * @return array $strings
 */
function bp_activity_heartbeat_strings($strings = array())
{
    if (!bp_activity_do_heartbeat()) {
        return $strings;
    }
    $global_pulse = 0;
    /**
     * Filter that checks whether the global heartbeat settings already exist.
     *
     * @since 2.0.0
     *
     * @param array $value Heartbeat settings array.
     */
    $heartbeat_settings = apply_filters('heartbeat_settings', array());
    if (!empty($heartbeat_settings['interval'])) {
        // 'Fast' is 5
        $global_pulse = is_numeric($heartbeat_settings['interval']) ? absint($heartbeat_settings['interval']) : 5;
    }
    /**
     * Filters the pulse frequency to be used for the BuddyPress Activity heartbeat.
     *
     * @since 2.0.0
     *
     * @param int $value The frequency in seconds between pulses.
     */
    $bp_activity_pulse = apply_filters('bp_activity_heartbeat_pulse', 15);
    /**
     * Use the global pulse value unless:
     * a. the BP-specific value has been specifically filtered, or
     * b. it doesn't exist (ie, BP will be the only one using the heartbeat,
     *    so we're responsible for enabling it)
     */
    if (has_filter('bp_activity_heartbeat_pulse') || empty($global_pulse)) {
        $pulse = $bp_activity_pulse;
    } else {
        $pulse = $global_pulse;
    }
    $strings = array_merge($strings, array('newest' => __('Load Newest', 'buddypress'), 'pulse' => absint($pulse)));
    return $strings;
}
/**
 * Set the strings for WP HeartBeat API where needed.
 *
 * @since BuddyPress (2.0.0)
 *
 * @param array $strings Localized strings.
 * @return array $strings
 */
function bp_activity_heartbeat_strings($strings = array())
{
    if (!bp_activity_do_heartbeat()) {
        return $strings;
    }
    $global_pulse = 0;
    // Check whether the global heartbeat settings already exist.
    $heartbeat_settings = apply_filters('heartbeat_settings', array());
    if (!empty($heartbeat_settings['interval'])) {
        // 'Fast' is 5
        $global_pulse = is_numeric($heartbeat_settings['interval']) ? absint($heartbeat_settings['interval']) : 5;
    }
    // Filter here to specify a BP-specific pulse frequency
    $bp_activity_pulse = apply_filters('bp_activity_heartbeat_pulse', 15);
    /**
     * Use the global pulse value unless:
     * a. the BP-specific value has been specifically filtered, or
     * b. it doesn't exist (ie, BP will be the only one using the heartbeat,
     *    so we're responsible for enabling it)
     */
    if (has_filter('bp_activity_heartbeat_pulse') || empty($global_pulse)) {
        $pulse = $bp_activity_pulse;
    } else {
        $pulse = $global_pulse;
    }
    $strings = array_merge($strings, array('newest' => __('Load Newest', 'buddypress'), 'pulse' => absint($pulse)));
    return $strings;
}