} if (is_user_logged_in()) { if (bp_activity_can_favorite()) { if (!bp_get_activity_is_favorite()) { $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'buddypress')) . '"></a>'; } else { $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'buddypress')) . '"></a>'; } } if (bp_activity_user_can_delete()) { $output .= bp_get_activity_delete_link(); } } $output .= '</div>'; if (bp_get_activity_type() == 'activity_comment') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View', 'buddypress') . '">' . __('View', 'buddypress'); } // end bp_get_activity_type() $output .= '</div>'; // end activity content $output .= '</li>'; } $output .= '</ul>'; } else { $output .= '<div class="alert alert-info">Right now there is no activity to show</div>'; } if ($show_button == 'yes') { $output .= '<a href="' . $button_link . '" title="" class="pull-right btn btn-large btn-primary">' . $button_label . '</a>'; } $output .= '</div>'; $output .= '</div>';
/** * Enable sharing interface at selected areas. */ function the_champ_render_sharing($content) { global $post; // hook to bypass sharing $disable = apply_filters('the_champ_bypass_sharing', $post, $content); // if $disable value is 1, return content without sharing interface if ($disable === 1) { return $content; } $sharingMeta = get_post_meta($post->ID, '_the_champ_meta', true); global $theChampSharingOptions, $theChampCounterOptions; $sharingBpActivity = false; $counterBpActivity = false; if (current_filter() == 'bp_activity_entry_meta') { if (isset($theChampSharingOptions['bp_activity'])) { $sharingBpActivity = true; } if (isset($theChampCounterOptions['bp_activity'])) { $counterBpActivity = true; } } if (isset($theChampCounterOptions['enable'])) { //counter interface if (isset($theChampCounterOptions['hor_enable']) && !(isset($sharingMeta['counter']) && $sharingMeta['counter'] == 1 && !is_front_page())) { if ($counterBpActivity) { $counterPostUrl = bp_get_activity_thread_permalink(); } elseif (isset($theChampCounterOptions['horizontal_target_url'])) { if ($theChampCounterOptions['horizontal_target_url'] == 'default') { $counterPostUrl = get_permalink($post->ID); } elseif ($theChampCounterOptions['horizontal_target_url'] == 'home') { $counterPostUrl = site_url(); } elseif ($theChampCounterOptions['horizontal_target_url'] == 'custom') { $counterPostUrl = isset($theChampCounterOptions['horizontal_target_url_custom']) ? trim($theChampCounterOptions['horizontal_target_url_custom']) : get_permalink($post->ID); } } else { $counterPostUrl = get_permalink($post->ID); } $counterUrl = $counterPostUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'horizontal', $counterUrl); $sharingContainerStyle = ''; $sharingTitleStyle = 'style="font-weight:bold"'; if (isset($theChampCounterOptions['hor_counter_alignment'])) { if ($theChampCounterOptions['hor_counter_alignment'] == 'right') { $sharingContainerStyle = 'style="float: right"'; } elseif ($theChampCounterOptions['hor_counter_alignment'] == 'center') { $sharingContainerStyle = 'style="float: right;position: relative;left: -50%;text-align: left;"'; $sharingTitleStyle = 'style="font-weight: bold;list-style: none;position: relative;left: 50%;"'; } } $horizontalDiv = "<div style='clear: both'></div><div " . $sharingContainerStyle . " class='the_champ_counter_container the_champ_horizontal_counter'><div " . $sharingTitleStyle . ">" . ucfirst($theChampCounterOptions['title']) . "</div>" . $sharingDiv . "</div><div style='clear: both'></div>"; if ($counterBpActivity) { echo $horizontalDiv; } // show horizontal counter if (isset($theChampCounterOptions['home']) && is_front_page() || isset($theChampCounterOptions['category']) && is_category() || isset($theChampCounterOptions['post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampCounterOptions['page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampCounterOptions['excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($theChampCounterOptions['bb_reply']) && current_filter() == 'bbp_get_reply_content' || isset($theChampCounterOptions['bb_forum']) && (isset($theChampCounterOptions['top']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampCounterOptions['bottom']) && current_filter() == 'bbp_template_after_single_forum') || isset($theChampCounterOptions['bb_topic']) && (isset($theChampCounterOptions['top']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || isset($theChampCounterOptions['bottom']) && in_array(current_filter(), array('bbp_template_after_single_topic', 'bbp_template_after_lead_topic')))) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bbp_template_after_single_topic', 'bbp_template_after_lead_topic', 'bbp_template_after_single_forum'))) { echo '<div style="clear:both"></div>' . $horizontalDiv . '<div style="clear:both"></div>'; } else { if (isset($theChampCounterOptions['top']) && isset($theChampCounterOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampCounterOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampCounterOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } } if (isset($theChampCounterOptions['vertical_enable']) && !(isset($sharingMeta['vertical_counter']) && $sharingMeta['vertical_counter'] == 1 && !is_front_page())) { if (isset($theChampCounterOptions['vertical_target_url'])) { if ($theChampCounterOptions['vertical_target_url'] == 'default') { $counterPostUrl = get_permalink($post->ID); } elseif ($theChampCounterOptions['vertical_target_url'] == 'home') { $counterPostUrl = site_url(); } elseif ($theChampCounterOptions['vertical_target_url'] == 'custom') { $counterPostUrl = isset($theChampCounterOptions['vertical_target_url_custom']) ? trim($theChampCounterOptions['vertical_target_url_custom']) : get_permalink($post->ID); } } else { $counterPostUrl = get_permalink($post->ID); } $counterUrl = $counterPostUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'vertical', $counterUrl); $verticalDiv = "<div class='the_champ_counter_container the_champ_vertical_counter' style='" . (isset($theChampCounterOptions['alignment']) && $theChampCounterOptions['alignment'] != '' && isset($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) ? $theChampCounterOptions['alignment'] . ': ' . ($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset'] == '' ? 0 : $theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) . 'px;' : '') . (isset($theChampCounterOptions['top_offset']) ? 'top: ' . ($theChampCounterOptions['top_offset'] == '' ? 0 : $theChampCounterOptions['top_offset']) . 'px;' : '') . (isset($theChampCounterOptions['vertical_bg']) && $theChampCounterOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampCounterOptions['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "'>" . $sharingDiv . "</div>"; // show vertical counter if (isset($theChampCounterOptions['vertical_home']) && is_front_page() || isset($theChampCounterOptions['vertical_category']) && is_category() || isset($theChampCounterOptions['vertical_post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampCounterOptions['vertical_page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampCounterOptions['vertical_excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($theChampCounterOptions['vertical_bb_forum']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampCounterOptions['vertical_bb_topic']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic'))) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum'))) { echo $verticalDiv; } else { if (is_front_page()) { global $theChampVerticalCounterHomeCount, $theChampVerticalCounterExcerptCount; if (current_filter() == 'the_content') { $var = 'theChampVerticalCounterHomeCount'; } elseif (current_filter() == 'get_the_excerpt') { $var = 'theChampVerticalCounterExcerptCount'; } if (${$var} == 0) { if (isset($theChampCounterOptions['vertical_target_url']) && $theChampCounterOptions['vertical_target_url'] == 'default') { $counterPostUrl = site_url(); $counterUrl = $counterPostUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'vertical', $counterUrl); $verticalDiv = "<div class='the_champ_counter_container the_champ_vertical_counter' style='" . (isset($theChampCounterOptions['alignment']) && $theChampCounterOptions['alignment'] != '' && isset($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) ? $theChampCounterOptions['alignment'] . ': ' . ($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset'] == '' ? 0 : $theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) . 'px;' : '') . (isset($theChampCounterOptions['top_offset']) ? 'top: ' . ($theChampCounterOptions['top_offset'] == '' ? 0 : $theChampCounterOptions['top_offset']) . 'px;' : '') . (isset($theChampCounterOptions['vertical_bg']) && $theChampCounterOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampCounterOptions['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "'>" . $sharingDiv . "</div>"; } $content = $content . $verticalDiv; ${$var}++; } } else { $content = $content . $verticalDiv; } } } } } if (isset($theChampSharingOptions['enable'])) { // sharing interface if (isset($theChampSharingOptions['hor_enable']) && !(isset($sharingMeta['sharing']) && $sharingMeta['sharing'] == 1 && !is_front_page())) { if ($sharingBpActivity) { $postUrl = bp_get_activity_thread_permalink(); } elseif (isset($theChampSharingOptions['horizontal_target_url'])) { if ($theChampSharingOptions['horizontal_target_url'] == 'default') { $postUrl = get_permalink($post->ID); } elseif ($theChampSharingOptions['horizontal_target_url'] == 'home') { $postUrl = site_url(); } elseif ($theChampSharingOptions['horizontal_target_url'] == 'custom') { $postUrl = isset($theChampSharingOptions['horizontal_target_url_custom']) ? trim($theChampSharingOptions['horizontal_target_url_custom']) : get_permalink($post->ID); } } else { $postUrl = get_permalink($post->ID); } $sharingUrl = $postUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl); if ($shortUrl) { $sharingUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'horizontal', isset($theChampSharingOptions['horizontal_counts'])); $sharingContainerStyle = ''; $sharingTitleStyle = 'style="font-weight:bold"'; if (isset($theChampSharingOptions['hor_sharing_alignment'])) { if ($theChampSharingOptions['hor_sharing_alignment'] == 'right') { $sharingContainerStyle = 'style="float: right"'; } elseif ($theChampSharingOptions['hor_sharing_alignment'] == 'center') { $sharingContainerStyle = 'style="float: right;position: relative;left: -50%;text-align: left;"'; $sharingTitleStyle = 'style="font-weight: bold;list-style: none;position: relative;left: 50%;"'; } } $horizontalDiv = "<div style='clear: both'></div><div " . $sharingContainerStyle . " class='the_champ_sharing_container the_champ_horizontal_sharing' super-socializer-data-href='" . $postUrl . "'><div " . $sharingTitleStyle . " >" . ucfirst($theChampSharingOptions['title']) . "</div>" . $sharingDiv . "</div><div style='clear: both'></div>"; if ($sharingBpActivity) { echo $horizontalDiv; } // show horizontal sharing if (isset($theChampSharingOptions['home']) && is_front_page() || isset($theChampSharingOptions['category']) && is_category() || isset($theChampSharingOptions['post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampSharingOptions['page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampSharingOptions['excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($theChampSharingOptions['bb_reply']) && current_filter() == 'bbp_get_reply_content' || isset($theChampSharingOptions['bb_forum']) && (isset($theChampSharingOptions['top']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampSharingOptions['bottom']) && current_filter() == 'bbp_template_after_single_forum') || isset($theChampSharingOptions['bb_topic']) && (isset($theChampSharingOptions['top']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || isset($theChampSharingOptions['bottom']) && in_array(current_filter(), array('bbp_template_after_single_topic', 'bbp_template_after_lead_topic')))) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bbp_template_after_single_topic', 'bbp_template_after_lead_topic', 'bbp_template_after_single_forum'))) { echo '<div style="clear:both"></div>' . $horizontalDiv . '<div style="clear:both"></div>'; } else { if (isset($theChampSharingOptions['top']) && isset($theChampSharingOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampSharingOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampSharingOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } } if (isset($theChampSharingOptions['vertical_enable']) && !(isset($sharingMeta['vertical_sharing']) && $sharingMeta['vertical_sharing'] == 1 && !is_front_page())) { if (isset($theChampSharingOptions['vertical_target_url'])) { if ($theChampSharingOptions['vertical_target_url'] == 'default') { $postUrl = get_permalink($post->ID); } elseif ($theChampSharingOptions['vertical_target_url'] == 'home') { $postUrl = site_url(); } elseif ($theChampSharingOptions['vertical_target_url'] == 'custom') { $postUrl = isset($theChampSharingOptions['vertical_target_url_custom']) ? trim($theChampSharingOptions['vertical_target_url_custom']) : get_permalink($post->ID); } } else { $postUrl = get_permalink($post->ID); } $sharingUrl = $postUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl); if ($shortUrl) { $sharingUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($theChampSharingOptions['vertical_counts'])); $verticalDiv = "<div class='the_champ_sharing_container the_champ_vertical_sharing' style='" . (isset($theChampSharingOptions['alignment']) && $theChampSharingOptions['alignment'] != '' && isset($theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset']) && $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] != '' ? $theChampSharingOptions['alignment'] . ': ' . $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] . 'px;' : '') . (isset($theChampSharingOptions['top_offset']) && $theChampSharingOptions['top_offset'] != '' ? 'top: ' . $theChampSharingOptions['top_offset'] . 'px;' : '') . (isset($theChampSharingOptions['vertical_bg']) && $theChampSharingOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampSharingOptions['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $postUrl . "'>" . $sharingDiv . "</div>"; // show vertical sharing if (isset($theChampSharingOptions['vertical_home']) && is_front_page() || isset($theChampSharingOptions['vertical_category']) && is_category() || isset($theChampSharingOptions['vertical_post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampSharingOptions['vertical_page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampSharingOptions['vertical_excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($theChampSharingOptions['vertical_bb_forum']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampSharingOptions['vertical_bb_topic']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic'))) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum'))) { echo $verticalDiv; } else { if (is_front_page()) { global $theChampVerticalHomeCount, $theChampVerticalExcerptCount; if (current_filter() == 'the_content') { $var = 'theChampVerticalHomeCount'; } elseif (current_filter() == 'get_the_excerpt') { $var = 'theChampVerticalExcerptCount'; } if (${$var} == 0) { if (isset($theChampSharingOptions['vertical_target_url']) && $theChampSharingOptions['vertical_target_url'] == 'default') { $postUrl = site_url(); $sharingUrl = $postUrl; // if bit.ly integration enabled, generate bit.ly short url if (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl); if ($shortUrl) { $sharingUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($theChampSharingOptions['vertical_counts'])); $verticalDiv = "<div class='the_champ_sharing_container the_champ_vertical_sharing' style='" . (isset($theChampSharingOptions['alignment']) && $theChampSharingOptions['alignment'] != '' && isset($theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset']) && $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] != '' ? $theChampSharingOptions['alignment'] . ': ' . $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] . 'px;' : '') . (isset($theChampSharingOptions['top_offset']) && $theChampSharingOptions['top_offset'] != '' ? 'top: ' . $theChampSharingOptions['top_offset'] . 'px;' : '') . (isset($theChampSharingOptions['vertical_bg']) && $theChampSharingOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampSharingOptions['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $postUrl . "'>" . $sharingDiv . "</div>"; } $content = $content . $verticalDiv; ${$var}++; } } else { $content = $content . $verticalDiv; } } } } } return $content; }
/** * Truncate long activity entries when viewed in activity streams. * * This method can only be used inside the Activity loop. * * @since 1.5.0 * * @uses bp_is_single_activity() * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook. * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook. * @uses bp_create_excerpt() * @uses bp_get_activity_id() * @uses bp_get_activity_thread_permalink() * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook. * * @param string $text The original activity entry text. * @return string $excerpt The truncated text. */ function bp_activity_truncate_entry($text) { global $activities_template; /** * Provides a filter that lets you choose whether to skip this filter on a per-activity basis. * * @since 2.3.0 * * @param bool $value If true, text should be checked to see if it needs truncating. */ $maybe_truncate_text = apply_filters('bp_activity_maybe_truncate_entry', isset($activities_template->activity->type) && !in_array($activities_template->activity->type, array('new_blog_post'), true)); // The full text of the activity update should always show on the single activity screen. if (!$maybe_truncate_text || bp_is_single_activity()) { return $text; } /** * Filters the appended text for the activity excerpt. * * @since 1.5.0 * * @param string $value Internationalized "Read more" text. */ $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress')); /** * Filters the excerpt length for the activity excerpt. * * @since 1.5.0 * * @param int $value Number indicating how many words to trim the excerpt down to. */ $excerpt_length = apply_filters('bp_activity_excerpt_length', 358); // Run the text through the excerpt function. If it's too short, the original text will be returned. $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('…', 'buddypress'))); /* * If the text returned by bp_create_excerpt() is different from the original text (ie it's * been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping * shortcodes, so we have strip them from the $text before the comparison. */ if ($excerpt != strip_shortcodes($text)) { $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id(); $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text); } /** * Filters the composite activity excerpt entry. * * @since 1.5.0 * * @param string $excerpt Excerpt text and markup to be displayed. * @param string $text The original activity entry text. * @param string $append_text The final append text applied. */ return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text); }
/** * Truncates long activity entries when viewed in activity streams * * @since 1.5.0 * * @param $text The original activity entry text * * @uses bp_is_single_activity() * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook * @uses bp_create_excerpt() * @uses bp_get_activity_id() * @uses bp_get_activity_thread_permalink() * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook * * @return string $excerpt The truncated text */ function bp_activity_truncate_entry($text) { global $activities_template; // The full text of the activity update should always show on the single activity screen if (bp_is_single_activity()) { return $text; } $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress')); $excerpt_length = apply_filters('bp_activity_excerpt_length', 358); // Run the text through the excerpt function. If it's too short, the original text will be // returned. $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('…', 'buddypress'))); // If the text returned by bp_create_excerpt() is different from the original text (ie it's // been truncated), add the "Read More" link. if ($excerpt != $text) { $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id(); $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text); } return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text); }
/** * Echoes the activity thread permalink * * @since 1.2.0 * * @uses bp_get_activity_permalink_id() */ function bp_activity_thread_permalink() { echo bp_get_activity_thread_permalink(); }
function buddy_social_button_activity_filter() { // buddypress activity $activity_type = bp_get_activity_type(); $activity_link = bp_get_activity_thread_permalink(); $activity_title = bp_get_activity_feed_item_title(); echo '<div style="clear: both;\\"></div>'; $options = $this->options; $essb_networks = $options['networks']; $buttons = ""; foreach ($essb_networks as $k => $v) { if ($v[0] == 1) { if ($buttons != '') { $buttons .= ","; } $buttons .= $k; } } $activity_title = str_replace('[…]', '', $activity_title); $need_counters = $options['show_counter'] ? 1 : 0; $links = do_shortcode('[easy-share buttons="' . $buttons . '" counters=0 native="no" url="' . urlencode($activity_link) . '" text="' . htmlspecialchars($activity_title) . '" nostats="yes" hide_names="yes"]'); echo $links . '<div style="clear: both;\\"></div>'; }
/** * Enable sharing interface at selected areas. * * @since 1.0.0 */ public function render_sharing($content) { global $post; // hook to bypass sharing $disable_sharing = apply_filters('heateor_sss_disable_sharing', $post, $content); // if $disable_sharing value is 1, return content without sharing interface if ($disable_sharing === 1) { return $content; } $sharing_meta = get_post_meta($post->ID, '_heateor_sss_meta', true); $sharing_bp_activity = false; if (current_filter() == 'bp_activity_entry_meta') { if (isset($this->options['bp_activity'])) { $sharing_bp_activity = true; } } $post_types = get_post_types(array('public' => true), 'names', 'and'); $post_types = array_diff($post_types, array('post', 'page')); // sharing interface if (isset($this->options['hor_enable']) && !(isset($sharing_meta['sharing']) && $sharing_meta['sharing'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $post_id = $post->ID; // default post url $post_url = get_permalink($post->ID); if ($sharing_bp_activity) { $post_url = bp_get_activity_thread_permalink(); $post_id = 0; } else { if ($this->options['horizontal_target_url'] == 'default') { $post_url = get_permalink($post->ID); if ($post_url == '') { $post_url = html_entity_decode(esc_url($this->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($this->options['horizontal_target_url'] == 'home') { $post_url = site_url(); $post_id = 0; } elseif ($this->options['horizontal_target_url'] == 'custom') { $post_url = $this->options['horizontal_target_url_custom'] ? $this->options['horizontal_target_url_custom'] : get_permalink($post->ID); $post_id = 0; } } $sharing_url = $this->get_short_url($post_url, $post->ID); // share count transient ID $this->share_count_transient_id = $this->get_share_count_transient_id($post_url); $sharing_div = $this->prepare_sharing_html($sharing_url ? $sharing_url : $post_url, 'horizontal', isset($this->options['horizontal_counts']), isset($this->options['horizontal_total_shares'])); $sharing_container_style = ''; $sharing_title_style = 'style="font-weight:bold"'; if ($this->options['hor_sharing_alignment'] == 'right') { $sharing_container_style = 'style="float: right"'; } elseif ($this->options['hor_sharing_alignment'] == 'center') { $sharing_container_style = 'style="float: right;position: relative;left: -50%;text-align: left;"'; $sharing_title_style = 'style="font-weight: bold;list-style: none;position: relative;left: 50%;"'; } $horizontal_div = "<div style='clear: both'></div><div " . $sharing_container_style . " class='heateor_sss_sharing_container heateor_sss_horizontal_sharing' " . ($this->get_cached_share_count($this->share_count_transient_id) === false ? "heateor-sss-data-href='" . $post_url . "'" : '') . "><div class='heateor_sss_sharing_title' " . $sharing_title_style . " >" . ucfirst($this->options['title']) . "</div>" . $sharing_div . "</div><div style='clear: both'></div>"; if ($sharing_bp_activity) { echo $horizontal_div; } // show horizontal sharing if (isset($this->options['home']) && is_front_page() || isset($this->options['category']) && is_category() || isset($this->options['archive']) && is_archive() || isset($this->options['post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($this->options['page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($this->options['excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($this->options['bb_reply']) && current_filter() == 'bbp_get_reply_content' || isset($this->options['bb_forum']) && (isset($this->options['top']) && current_filter() == 'bbp_template_before_single_forum' || isset($this->options['bottom']) && current_filter() == 'bbp_template_after_single_forum') || isset($this->options['bb_topic']) && (isset($this->options['top']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || isset($this->options['bottom']) && in_array(current_filter(), array('bbp_template_after_single_topic', 'bbp_template_after_lead_topic'))) || isset($this->options['woocom_shop']) && current_filter() == 'woocommerce_after_shop_loop_item' || isset($this->options['woocom_product']) && current_filter() == 'woocommerce_share' || isset($this->options['woocom_thankyou']) && current_filter() == 'woocommerce_thankyou' || current_filter() == 'bp_before_group_header' && isset($this->options['bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bbp_template_after_single_topic', 'bbp_template_after_lead_topic', 'bbp_template_after_single_forum', 'woocommerce_after_shop_loop_item', 'woocommerce_share', 'woocommerce_thankyou', 'bp_before_group_header'))) { echo '<div style="clear:both"></div>' . $horizontal_div . '<div style="clear:both"></div>'; } else { if (isset($this->options['top']) && isset($this->options['bottom'])) { $content = $horizontal_div . '<br/>' . $content . '<br/>' . $horizontal_div; } else { if (isset($this->options['top'])) { $content = $horizontal_div . $content; } elseif (isset($this->options['bottom'])) { $content = $content . $horizontal_div; } } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($this->options[$post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { if (isset($this->options['top']) && isset($this->options['bottom'])) { $content = $horizontal_div . '<br/>' . $content . '<br/>' . $horizontal_div; } else { if (isset($this->options['top'])) { $content = $horizontal_div . $content; } elseif (isset($this->options['bottom'])) { $content = $content . $horizontal_div; } } } } } } if (isset($this->options['vertical_enable']) && !(isset($sharing_meta['vertical_sharing']) && $sharing_meta['vertical_sharing'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $post_id = $post->ID; $post_url = get_permalink($post->ID); if ($this->options['vertical_target_url'] == 'default') { $post_url = get_permalink($post->ID); if ($post_url == '') { $post_url = html_entity_decode(esc_url($this->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($this->options['vertical_target_url'] == 'home') { $post_url = site_url(); $post_id = 0; } elseif ($this->options['vertical_target_url'] == 'custom') { $post_url = $this->options['vertical_target_url_custom'] ? $this->options['vertical_target_url_custom'] : get_permalink($post->ID); $post_id = 0; } $sharing_url = $this->get_short_url($post_url, $post->ID); $vertical_sharing_width = $this->options['vertical_sharing_shape'] == 'rectangle' ? $this->options['vertical_sharing_width'] : $this->options['vertical_sharing_size']; if (isset($this->options['vertical_counts']) && isset($this->options['vertical_counter_position']) && in_array($this->options['vertical_counter_position'], array('left', 'right'))) { $vertical_sharing_width += $vertical_sharing_width * 60 / 100; } // share count transient ID $this->share_count_transient_id = $this->get_share_count_transient_id($post_url); $sharing_div = $this->prepare_sharing_html($sharing_url ? $sharing_url : $post_url, 'vertical', isset($this->options['vertical_counts']), isset($this->options['vertical_total_shares'])); $offset = ($this->options['alignment'] != '' && $this->options[$this->options['alignment'] . '_offset'] != '' ? $this->options['alignment'] . ': ' . $this->options[$this->options['alignment'] . '_offset'] . 'px;' : '') . ($this->options['top_offset'] != '' ? 'top: ' . $this->options['top_offset'] . 'px;' : ''); $vertical_div = "<div class='heateor_sss_sharing_container heateor_sss_vertical_sharing" . (isset($this->options['bottom_mobile_sharing']) ? ' heateor_sss_bottom_sharing' : '') . "' style='width:" . ($vertical_sharing_width + 4) . "px;" . $offset . ($this->options['vertical_bg'] != '' ? 'background-color: ' . $this->options['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' " . ($this->get_cached_share_count($this->share_count_transient_id) === false ? "heateor-sss-data-href='" . $post_url . "'" : '') . ">" . $sharing_div . "</div>"; // show vertical sharing if (isset($this->options['vertical_home']) && is_front_page() || isset($this->options['vertical_category']) && is_category() || isset($this->options['vertical_archive']) && is_archive() || isset($this->options['vertical_post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($this->options['vertical_page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($this->options['vertical_excerpt']) && is_front_page() && current_filter() == 'get_the_excerpt' || isset($this->options['vertical_bb_forum']) && current_filter() == 'bbp_template_before_single_forum' || isset($this->options['vertical_bb_topic']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || current_filter() == 'bp_before_group_header' && isset($this->options['vertical_bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bp_before_group_header'))) { echo $vertical_div; } else { if (is_front_page()) { if (current_filter() == 'the_content') { $var = $this->vertical_home_count; } elseif (current_filter() == 'get_the_excerpt') { $var = $this->vertical_excerpt_count; } if ($var == 0) { if ($this->options['vertical_target_url'] == 'default') { $post_url = site_url(); $sharing_url = $this->get_short_url($post_url, 0); // share count transient ID $this->share_count_transient_id = 0; $sharing_div = $this->prepare_sharing_html($sharing_url ? $sharing_url : $post_url, 'vertical', isset($this->options['vertical_counts']), isset($this->options['vertical_total_shares'])); $vertical_div = "<div class='heateor_sss_sharing_container heateor_sss_vertical_sharing" . (isset($this->options['bottom_mobile_sharing']) ? ' heateor_sss_bottom_sharing' : '') . "' style='width:" . ($vertical_sharing_width + 4) . "px;" . $offset . ($this->options['vertical_bg'] != '' ? 'background-color: ' . $this->options['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' " . ($this->get_cached_share_count(0) === false ? "heateor-sss-data-href='" . $post_url . "'" : '') . ">" . $sharing_div . "</div>"; } $content = $content . $vertical_div; if (current_filter() == 'the_content') { $this->vertical_home_count++; } elseif (current_filter() == 'get_the_excerpt') { $this->vertical_excerpt_count++; } } } else { $content = $content . $vertical_div; } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($this->options['vertical_' . $post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { $content = $content . $vertical_div; } } } } return $content; }
/** * @deprecated gears_get_activity_stream */ function gears_get_activity_stream() { $output = ''; $output .= '<li class="' . bp_get_activity_css_class() . '" id="activity-' . bp_get_activity_id() . '">'; $output .= '<div class="activity-avatar">'; $output .= '<a class="gears-activity-avatar" title="' . __('View Profile', 'gears') . '" href="' . bp_get_activity_user_link() . '">'; $output .= bp_get_activity_avatar(); $output .= '</a>'; $output .= '</div>'; // activity content $output .= '<div class="activity-content">'; $output .= '<div class="activity-header">'; $output .= bp_get_activity_action(); $output .= '</div>'; $output .= '<div class="activity-inner">'; if (bp_activity_has_content()) { $output .= bp_get_activity_content_body(); } $output .= '</div>'; do_action('bp_activity_entry_content'); $output .= '<div class="activity-meta">'; if (bp_get_activity_type() == 'activity_comment') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears') . '</a>'; } if (is_user_logged_in()) { if (bp_activity_can_favorite()) { if (!bp_get_activity_is_favorite()) { $output .= '<a href="' . bp_get_activity_favorite_link() . '" class="fav bp-secondary-action" title="' . esc_attr(__('Mark as Favorite', 'gears')) . '">' . __('Favorite', 'gears') . '</a>'; } else { $output .= '<a href="' . bp_get_activity_unfavorite_link() . '" class="unfav bp-secondary-action" title="' . esc_attr(__('Remove Favorite', 'gears')) . '">' . __('Remove Favorite', 'gears') . '</a>'; } } if (bp_activity_user_can_delete()) { $output .= bp_get_activity_delete_link(); } do_action('bp_activity_entry_meta'); } $output .= '</div>'; if (bp_get_activity_type() == 'activity_comment') { $output .= '<a href="' . bp_get_activity_thread_permalink() . '" class="view bp-secondary-action" title="' . __('View Conversation', 'gears') . '">' . __('View Conversation', 'gears'); } // end bp_get_activity_type() $output .= '</div>'; // end activity content $output .= '</li>'; return $output; }
</div> <div class="acomment-content"> <?php /* translators: 1: user profile link, 2: user name, 3: activity permalink, 3: activity timestamp */ printf(__('<strong><a href="%1$s">%2$s</a></strong> ', 'buddypress'), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded()); ?> <?php bp_activity_comment_content(); ?> <div class="acomment-options"> <?php /* translators: 1: user profile link, 2: user name, 3: activity permalink, 3: activity timestamp */ printf(__('<span class="time-since">%4$s</span>', 'buddypress'), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded()); ?> <?php if (is_user_logged_in() && bp_activity_can_comment_reply(bp_activity_current_comment())) { ?> · <a href="#acomment-<?php bp_activity_comment_id(); ?> " class="acomment-reply bp-primary-action" id="acomment-reply-<?php bp_activity_id(); ?> -from-<?php bp_activity_comment_id(); ?>
?> <li id="acomment-<?php bp_activity_comment_id(); ?> " class="well well-sm"> <div class="acomment-content text-left"><?php bp_activity_comment_content(); ?> </div> <div class="acomment-meta text-right"> <?php /* translators: 1: user profile link, 2: user name, 3: activity permalink, 4: activity timestamp */ printf(__('<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since">%4$s</span></a>', 'firmasite'), bp_get_activity_comment_user_link(), bp_activity_avatar('type=thumb&width=20&user_id=' . bp_get_activity_comment_user_id()) . bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded()); ?> </div> <div class="acomment-options text-right"> <?php if (is_user_logged_in() && bp_activity_can_comment_reply(bp_activity_current_comment())) { ?> <a href="#acomment-<?php bp_activity_comment_id(); ?> " class="acomment-reply bp-primary-action text-success btn-xs" id="acomment-reply-<?php bp_activity_id(); ?>
function BuddystreamShareButton() { $buddyStreamExtensions = new BuddyStreamExtensions(); $shares = array(); foreach ($buddyStreamExtensions->getExtensionsConfigs() as $extension) { if (get_site_option("buddystream_" . $extension['name'] . "_share") == "on") { $shares[] = $extension['name']; } } $shares = implode(',', $shares); echo '<a href="' . BP_BUDDYSTREAM_URL . '/extensions/default/templates/ShareBox.php?content=' . urlencode(strip_tags(bp_get_activity_content_body())) . '&link=' . urlencode(bp_get_activity_thread_permalink()) . '&shares=' . $shares . ' " class="bs_lightbox button item-button">Sharebox!</a>'; }
function handle_buddypress_activity_integration() { if ($this->check_applicability_module('buddypress')) { $activity_type = bp_get_activity_type(); $activity_link = bp_get_activity_thread_permalink(); $activity_title = bp_get_activity_feed_item_title(); printf('%1$s<div style="clear: both;"></div>', $this->generate_share_buttons('buddypress', 'share', array('only_share' => false, 'post_type' => 'buddypress', 'url' => $activity_link, 'title' => $activity_title))); } }
/** * Output the activity thread permalink. * * @since 1.2.0 * */ function bp_activity_thread_permalink() { echo esc_url(bp_get_activity_thread_permalink()); }
/** * This filters pics content, when reading an item it will convert it to use pics language * * @since BuddyBoss 2.0 */ function buddyboss_pics_read_content_filter($filter) { global $buddyboss_pics_img_size, $activities_template; $curr_id = $activities_template->current_activity; $act_id = (int) $activities_template->activities[$curr_id]->id; // Check for activity ID in $_POST if this is a single // activity request from a [read more] action if ($act_id === 0 && !empty($_POST['activity_id'])) { $activity_array = bp_activity_get_specific(array('activity_ids' => $_POST['activity_id'], 'display_comments' => 'stream')); $activity = !empty($activity_array['activities'][0]) ? $activity_array['activities'][0] : false; $act_id = (int) $activity->id; } // This should never happen, but if it does, bail. if ($act_id === 0) { return $filter; } $buddyboss_pics_aid = bp_activity_get_meta($act_id, 'buddyboss_pics_aid'); // Support for legacy BuddyBoss (we used to store meta keys with bboss_ before normalizing) if (!$buddyboss_pics_aid) { $buddyboss_pics_aid = bp_activity_get_meta($act_id, 'bboss_pics_aid'); } $img_size = is_active_sidebar('Profile') ? 'buddyboss_pic_med' : 'buddyboss_pic_wide'; $image = wp_get_attachment_image_src($buddyboss_pics_aid, $img_size); if (!empty($image) && is_array($image) && count($image) > 2) { $src = $image[0]; $w = $image[1]; $h = $image[2]; $full = wp_get_attachment_image_src($buddyboss_pics_aid, 'full'); $width_markup = $w > 0 ? ' width="' . $w . '"' : ''; if ($full !== false && is_array($full) && count($full) > 2) { $filter .= '<a class="buddyboss-pics-photo-wrap" href="' . $full[0] . '">'; $filter .= '<img data-permalink="' . bp_get_activity_thread_permalink() . '" class="buddyboss-pics-photo" src="' . $src . '"' . $width_markup . ' /></a>'; } else { $filter .= '<img data-permalink="' . bp_get_activity_thread_permalink() . '" class="buddyboss-pics-photo" src="' . $src . '"' . $width_markup . ' /></a>'; } } return $filter; }
/** * Enable sharing interface at selected areas. */ function the_champ_render_sharing($content) { global $post; // hook to bypass sharing $disable = apply_filters('the_champ_bypass_sharing', $post, $content); // if $disable value is 1, return content without sharing interface if ($disable === 1) { return $content; } $sharingMeta = get_post_meta($post->ID, '_the_champ_meta', true); global $theChampSharingOptions, $theChampCounterOptions; $sharingBpActivity = false; $counterBpActivity = false; if (current_filter() == 'bp_activity_entry_meta') { if (isset($theChampSharingOptions['bp_activity'])) { $sharingBpActivity = true; } if (isset($theChampCounterOptions['bp_activity'])) { $counterBpActivity = true; } } $post_types = get_post_types(array('public' => true), 'names', 'and'); $post_types = array_diff($post_types, array('post', 'page')); if (isset($theChampCounterOptions['enable'])) { //counter interface if (isset($theChampCounterOptions['hor_enable']) && !(isset($sharingMeta['counter']) && $sharingMeta['counter'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $postId = $post->ID; if ($counterBpActivity) { $counterPostUrl = bp_get_activity_thread_permalink(); } elseif (isset($theChampCounterOptions['horizontal_target_url'])) { if ($theChampCounterOptions['horizontal_target_url'] == 'default') { $counterPostUrl = get_permalink($post->ID); if ($counterPostUrl == '') { $counterPostUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($theChampCounterOptions['horizontal_target_url'] == 'home') { $counterPostUrl = site_url(); $postId = 0; } elseif ($theChampCounterOptions['horizontal_target_url'] == 'custom') { $counterPostUrl = isset($theChampCounterOptions['horizontal_target_url_custom']) ? trim($theChampCounterOptions['horizontal_target_url_custom']) : get_permalink($post->ID); $postId = 0; } } else { $counterPostUrl = get_permalink($post->ID); } $counterUrl = $counterPostUrl; if (isset($theChampCounterOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $counterUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl, $postId); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'horizontal', $counterUrl); $sharingContainerStyle = ''; $sharingTitleStyle = 'style="font-weight:bold"'; if (isset($theChampCounterOptions['hor_counter_alignment'])) { if ($theChampCounterOptions['hor_counter_alignment'] == 'right') { $sharingContainerStyle = 'style="float: right"'; } elseif ($theChampCounterOptions['hor_counter_alignment'] == 'center') { $sharingContainerStyle = 'style="float: right;position: relative;left: -50%;text-align: left;"'; $sharingTitleStyle = 'style="font-weight: bold;list-style: none;position: relative;left: 50%;"'; } } $horizontalDiv = "<div style='clear: both'></div><div " . $sharingContainerStyle . " class='the_champ_counter_container the_champ_horizontal_counter'><div " . $sharingTitleStyle . ">" . ucfirst($theChampCounterOptions['title']) . "</div>" . $sharingDiv . "</div><div style='clear: both'></div>"; if ($counterBpActivity) { echo $horizontalDiv; } // show horizontal counter if (isset($theChampCounterOptions['home']) && is_front_page() || isset($theChampCounterOptions['category']) && is_category() || isset($theChampCounterOptions['archive']) && is_archive() || isset($theChampCounterOptions['post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampCounterOptions['page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampCounterOptions['excerpt']) && (is_home() || current_filter() == 'the_excerpt') || isset($theChampCounterOptions['bb_reply']) && current_filter() == 'bbp_get_reply_content' || isset($theChampCounterOptions['bb_forum']) && (isset($theChampCounterOptions['top']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampCounterOptions['bottom']) && current_filter() == 'bbp_template_after_single_forum') || isset($theChampCounterOptions['bb_topic']) && (isset($theChampCounterOptions['top']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || isset($theChampCounterOptions['bottom']) && in_array(current_filter(), array('bbp_template_after_single_topic', 'bbp_template_after_lead_topic'))) || isset($theChampCounterOptions['woocom_shop']) && current_filter() == 'woocommerce_after_shop_loop_item' || isset($theChampCounterOptions['woocom_product']) && current_filter() == 'woocommerce_share' || isset($theChampCounterOptions['woocom_thankyou']) && current_filter() == 'woocommerce_thankyou' || current_filter() == 'bp_before_group_header' && isset($theChampCounterOptions['bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bbp_template_after_single_topic', 'bbp_template_after_lead_topic', 'bbp_template_after_single_forum', 'woocommerce_after_shop_loop_item', 'woocommerce_share', 'woocommerce_thankyou', 'bp_before_group_header'))) { echo '<div style="clear:both"></div>' . $horizontalDiv . '<div style="clear:both"></div>'; } else { if (isset($theChampCounterOptions['top']) && isset($theChampCounterOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampCounterOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampCounterOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($theChampCounterOptions[$post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { if (isset($theChampCounterOptions['top']) && isset($theChampCounterOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampCounterOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampCounterOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } } } if (isset($theChampCounterOptions['vertical_enable']) && !(isset($sharingMeta['vertical_counter']) && $sharingMeta['vertical_counter'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $postId = $post->ID; if (isset($theChampCounterOptions['vertical_target_url'])) { if ($theChampCounterOptions['vertical_target_url'] == 'default') { $counterPostUrl = get_permalink($post->ID); if ($counterPostUrl == '') { $counterPostUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($theChampCounterOptions['vertical_target_url'] == 'home') { $counterPostUrl = site_url(); $postId = 0; } elseif ($theChampCounterOptions['vertical_target_url'] == 'custom') { $counterPostUrl = isset($theChampCounterOptions['vertical_target_url_custom']) ? trim($theChampCounterOptions['vertical_target_url_custom']) : get_permalink($post->ID); $postId = 0; } } else { $counterPostUrl = get_permalink($post->ID); } $counterUrl = $counterPostUrl; if (isset($theChampCounterOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $counterUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl, $postId); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'vertical', $counterUrl); $offset = (isset($theChampCounterOptions['alignment']) && $theChampCounterOptions['alignment'] != '' && isset($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) ? $theChampCounterOptions['alignment'] . ': ' . ($theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset'] == '' ? 0 : $theChampCounterOptions[$theChampCounterOptions['alignment'] . '_offset']) . 'px;' : '') . (isset($theChampCounterOptions['top_offset']) ? 'top: ' . ($theChampCounterOptions['top_offset'] == '' ? 0 : $theChampCounterOptions['top_offset']) . 'px;' : ''); $verticalDiv = "<div class='the_champ_counter_container the_champ_vertical_counter" . (isset($theChampCounterOptions['hide_mobile_likeb']) ? ' the_champ_hide_sharing' : '') . "' style='" . $offset . (isset($theChampCounterOptions['vertical_bg']) && $theChampCounterOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampCounterOptions['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "'>" . $sharingDiv . "</div>"; // show vertical counter if (isset($theChampCounterOptions['vertical_home']) && is_front_page() || isset($theChampCounterOptions['vertical_category']) && is_category() || isset($theChampCounterOptions['vertical_archive']) && is_archive() || isset($theChampCounterOptions['vertical_post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampCounterOptions['vertical_page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampCounterOptions['vertical_excerpt']) && (is_home() || current_filter() == 'the_excerpt') || isset($theChampCounterOptions['vertical_bb_forum']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampCounterOptions['vertical_bb_topic']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || current_filter() == 'bp_before_group_header' && isset($theChampCounterOptions['vertical_bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bp_before_group_header'))) { echo $verticalDiv; } else { if (is_front_page()) { global $theChampVerticalCounterHomeCount, $theChampVerticalCounterExcerptCount; if (current_filter() == 'the_content') { $var = 'theChampVerticalCounterHomeCount'; } elseif (is_home() || current_filter() == 'the_excerpt') { $var = 'theChampVerticalCounterExcerptCount'; } if (${$var} == 0) { if (isset($theChampCounterOptions['vertical_target_url']) && $theChampCounterOptions['vertical_target_url'] == 'default') { $counterPostUrl = site_url(); $counterUrl = $counterPostUrl; if (isset($theChampCounterOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $counterUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampCounterOptions['bitly_enable']) && isset($theChampCounterOptions['bitly_username']) && isset($theChampCounterOptions['bitly_username']) && $theChampCounterOptions['bitly_username'] != '' && isset($theChampCounterOptions['bitly_key']) && $theChampCounterOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_counter_bitly_url($counterPostUrl, 0); if ($shortUrl) { $counterUrl = $shortUrl; } } $sharingDiv = the_champ_prepare_counter_html($counterPostUrl, 'vertical', $counterUrl); $verticalDiv = "<div class='the_champ_counter_container the_champ_vertical_counter" . (isset($theChampCounterOptions['hide_mobile_likeb']) ? ' the_champ_hide_sharing' : '') . "' style='" . $offset . (isset($theChampCounterOptions['vertical_bg']) && $theChampCounterOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampCounterOptions['vertical_bg'] . ';' : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "'>" . $sharingDiv . "</div>"; } $content = $content . $verticalDiv; ${$var}++; } } else { $content = $content . $verticalDiv; } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($theChampCounterOptions['vertical_' . $post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { $content = $content . $verticalDiv; } } } } } if (isset($theChampSharingOptions['enable'])) { // sharing interface if (isset($theChampSharingOptions['hor_enable']) && !(isset($sharingMeta['sharing']) && $sharingMeta['sharing'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $postId = $post->ID; if ($sharingBpActivity) { $postUrl = bp_get_activity_thread_permalink(); $postId = 0; } elseif (isset($theChampSharingOptions['horizontal_target_url'])) { if ($theChampSharingOptions['horizontal_target_url'] == 'default') { $postUrl = get_permalink($post->ID); if ($postUrl == '') { $postUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($theChampSharingOptions['horizontal_target_url'] == 'home') { $postUrl = site_url(); $postId = 0; } elseif ($theChampSharingOptions['horizontal_target_url'] == 'custom') { $postUrl = isset($theChampSharingOptions['horizontal_target_url_custom']) ? trim($theChampSharingOptions['horizontal_target_url_custom']) : get_permalink($post->ID); $postId = 0; } } else { $postUrl = get_permalink($post->ID); } $sharingUrl = $postUrl; if (isset($theChampSharingOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $sharingUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl, $postId); if ($shortUrl) { $sharingUrl = $shortUrl; } } $shareCountTransientId = heateor_ss_get_share_count_transient_id($postUrl); $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'horizontal', isset($theChampSharingOptions['horizontal_counts']), isset($theChampSharingOptions['horizontal_total_shares']), $shareCountTransientId); $sharingContainerStyle = ''; $sharingTitleStyle = 'style="font-weight:bold"'; if (isset($theChampSharingOptions['hor_sharing_alignment'])) { if ($theChampSharingOptions['hor_sharing_alignment'] == 'right') { $sharingContainerStyle = 'style="float: right"'; } elseif ($theChampSharingOptions['hor_sharing_alignment'] == 'center') { $sharingContainerStyle = 'style="float: right;position: relative;left: -50%;text-align: left;"'; $sharingTitleStyle = 'style="font-weight: bold;list-style: none;position: relative;left: 50%;"'; } } $horizontalDiv = "<div style='clear: both'></div><div " . $sharingContainerStyle . " class='the_champ_sharing_container the_champ_horizontal_sharing' super-socializer-data-href='" . $postUrl . "'" . (heateor_ss_get_cached_share_count($shareCountTransientId) === false ? "" : 'super-socializer-no-counts="1"') . "><div class='the_champ_sharing_title' " . $sharingTitleStyle . " >" . ucfirst($theChampSharingOptions['title']) . "</div>" . $sharingDiv . "</div><div style='clear: both'></div>"; if ($sharingBpActivity) { echo $horizontalDiv; } // show horizontal sharing if (isset($theChampSharingOptions['home']) && is_front_page() || isset($theChampSharingOptions['category']) && is_category() || isset($theChampSharingOptions['archive']) && is_archive() || isset($theChampSharingOptions['post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampSharingOptions['page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampSharingOptions['excerpt']) && (is_home() || current_filter() == 'the_excerpt') || isset($theChampSharingOptions['bb_reply']) && current_filter() == 'bbp_get_reply_content' || isset($theChampSharingOptions['bb_forum']) && (isset($theChampSharingOptions['top']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampSharingOptions['bottom']) && current_filter() == 'bbp_template_after_single_forum') || isset($theChampSharingOptions['bb_topic']) && (isset($theChampSharingOptions['top']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || isset($theChampSharingOptions['bottom']) && in_array(current_filter(), array('bbp_template_after_single_topic', 'bbp_template_after_lead_topic'))) || isset($theChampSharingOptions['woocom_shop']) && current_filter() == 'woocommerce_after_shop_loop_item' || isset($theChampSharingOptions['woocom_product']) && current_filter() == 'woocommerce_share' || isset($theChampSharingOptions['woocom_thankyou']) && current_filter() == 'woocommerce_thankyou' || current_filter() == 'bp_before_group_header' && isset($theChampSharingOptions['bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bbp_template_after_single_topic', 'bbp_template_after_lead_topic', 'bbp_template_after_single_forum', 'woocommerce_after_shop_loop_item', 'woocommerce_share', 'woocommerce_thankyou', 'bp_before_group_header'))) { echo '<div style="clear:both"></div>' . $horizontalDiv . '<div style="clear:both"></div>'; } else { if (isset($theChampSharingOptions['top']) && isset($theChampSharingOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampSharingOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampSharingOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($theChampSharingOptions[$post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { if (isset($theChampSharingOptions['top']) && isset($theChampSharingOptions['bottom'])) { $content = $horizontalDiv . '<br/>' . $content . '<br/>' . $horizontalDiv; } else { if (isset($theChampSharingOptions['top'])) { $content = $horizontalDiv . $content; } elseif (isset($theChampSharingOptions['bottom'])) { $content = $content . $horizontalDiv; } } } } } } if (isset($theChampSharingOptions['vertical_enable']) && !(isset($sharingMeta['vertical_sharing']) && $sharingMeta['vertical_sharing'] == 1 && (!is_front_page() || is_front_page() && 'page' == get_option('show_on_front')))) { $postId = $post->ID; if (isset($theChampSharingOptions['vertical_target_url'])) { if ($theChampSharingOptions['vertical_target_url'] == 'default') { $postUrl = get_permalink($post->ID); if ($postUrl == '') { $postUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])); } } elseif ($theChampSharingOptions['vertical_target_url'] == 'home') { $postUrl = site_url(); $postId = 0; } elseif ($theChampSharingOptions['vertical_target_url'] == 'custom') { $postUrl = isset($theChampSharingOptions['vertical_target_url_custom']) ? trim($theChampSharingOptions['vertical_target_url_custom']) : get_permalink($post->ID); $postId = 0; } } else { $postUrl = get_permalink($post->ID); } $sharingUrl = $postUrl; if (isset($theChampSharingOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $sharingUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl, $postId); if ($shortUrl) { $sharingUrl = $shortUrl; } } $shareCountTransientId = heateor_ss_get_share_count_transient_id($postUrl); $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($theChampSharingOptions['vertical_counts']), isset($theChampSharingOptions['vertical_total_shares']), $shareCountTransientId); $offset = (isset($theChampSharingOptions['alignment']) && $theChampSharingOptions['alignment'] != '' && isset($theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset']) && $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] != '' ? $theChampSharingOptions['alignment'] . ': ' . $theChampSharingOptions[$theChampSharingOptions['alignment'] . '_offset'] . 'px;' : '') . (isset($theChampSharingOptions['top_offset']) && $theChampSharingOptions['top_offset'] != '' ? 'top: ' . $theChampSharingOptions['top_offset'] . 'px;' : ''); $verticalDiv = "<div class='the_champ_sharing_container the_champ_vertical_sharing" . (isset($theChampSharingOptions['hide_mobile_sharing']) ? ' the_champ_hide_sharing' : '') . (isset($theChampSharingOptions['bottom_mobile_sharing']) ? ' the_champ_bottom_sharing' : '') . "' style='width:" . ($theChampSharingOptions['vertical_sharing_size'] + 4) . "px;" . $offset . (isset($theChampSharingOptions['vertical_bg']) && $theChampSharingOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampSharingOptions['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $postUrl . "'" . (heateor_ss_get_cached_share_count($shareCountTransientId) === false ? "" : 'super-socializer-no-counts="1"') . ">" . $sharingDiv . "</div>"; // show vertical sharing if (isset($theChampSharingOptions['vertical_home']) && is_front_page() || isset($theChampSharingOptions['vertical_category']) && is_category() || isset($theChampSharingOptions['vertical_archive']) && is_archive() || isset($theChampSharingOptions['vertical_post']) && is_single() && isset($post->post_type) && $post->post_type == 'post' || isset($theChampSharingOptions['vertical_page']) && is_page() && isset($post->post_type) && $post->post_type == 'page' || isset($theChampSharingOptions['vertical_excerpt']) && (is_home() || current_filter() == 'the_excerpt') || isset($theChampSharingOptions['vertical_bb_forum']) && current_filter() == 'bbp_template_before_single_forum' || isset($theChampSharingOptions['vertical_bb_topic']) && in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic')) || current_filter() == 'bp_before_group_header' && isset($theChampSharingOptions['vertical_bp_group'])) { if (in_array(current_filter(), array('bbp_template_before_single_topic', 'bbp_template_before_lead_topic', 'bbp_template_before_single_forum', 'bp_before_group_header'))) { echo $verticalDiv; } else { if (is_front_page()) { global $theChampVerticalHomeCount, $theChampVerticalExcerptCount; if (current_filter() == 'the_content') { $var = 'theChampVerticalHomeCount'; } elseif (is_home() || current_filter() == 'the_excerpt') { $var = 'theChampVerticalExcerptCount'; } if (${$var} == 0) { if (isset($theChampSharingOptions['vertical_target_url']) && $theChampSharingOptions['vertical_target_url'] == 'default') { $postUrl = site_url(); $sharingUrl = $postUrl; if (isset($theChampSharingOptions['use_shortlinks']) && function_exists('wp_get_shortlink')) { $sharingUrl = wp_get_shortlink(); // if bit.ly integration enabled, generate bit.ly short url } elseif (isset($theChampSharingOptions['bitly_enable']) && isset($theChampSharingOptions['bitly_username']) && isset($theChampSharingOptions['bitly_username']) && $theChampSharingOptions['bitly_username'] != '' && isset($theChampSharingOptions['bitly_key']) && $theChampSharingOptions['bitly_key'] != '') { $shortUrl = the_champ_generate_sharing_bitly_url($postUrl, 0); if ($shortUrl) { $sharingUrl = $shortUrl; } } $shareCountTransientId = heateor_ss_get_share_count_transient_id($postUrl); $sharingDiv = the_champ_prepare_sharing_html($sharingUrl, 'vertical', isset($theChampSharingOptions['vertical_counts']), isset($theChampSharingOptions['vertical_total_shares']), $shareCountTransientId); $verticalDiv = "<div class='the_champ_sharing_container the_champ_vertical_sharing" . (isset($theChampSharingOptions['hide_mobile_sharing']) ? ' the_champ_hide_sharing' : '') . (isset($theChampSharingOptions['bottom_mobile_sharing']) ? ' the_champ_bottom_sharing' : '') . "' style='width:" . ($theChampSharingOptions['vertical_sharing_size'] + 4) . "px;" . $offset . (isset($theChampSharingOptions['vertical_bg']) && $theChampSharingOptions['vertical_bg'] != '' ? 'background-color: ' . $theChampSharingOptions['vertical_bg'] : '-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;') . "' super-socializer-data-href='" . $postUrl . "'" . (heateor_ss_get_cached_share_count($shareCountTransientId) === false ? "" : 'super-socializer-no-counts="1"') . ">" . $sharingDiv . "</div>"; } $content = $content . $verticalDiv; ${$var}++; } } else { $content = $content . $verticalDiv; } } } elseif (count($post_types)) { foreach ($post_types as $post_type) { if (isset($theChampSharingOptions['vertical_' . $post_type]) && (is_single() || is_page()) && isset($post->post_type) && $post->post_type == $post_type) { $content = $content . $verticalDiv; } } } } } return $content; }
function add_stream_facebooklike_button() { $permalink = bp_get_activity_thread_permalink(); if (preg_match('#/p/(\\d+)/?#i', $permalink, $matches)) { $permalink = bp_get_activity_user_link() . bp_get_activity_slug() . '/' . $matches[1] . '/'; } if (is_user_logged_in()) { ?> <div style="margin: 14px 0px; float:left; width: 100%; clear:both;"> <div class="fb-like" data-href="<?php echo esc_attr($permalink); ?> " data-send="false" data-width="450" data-show-faces="true"></div> </div> <?php } }
"> <div class="acomment-avatar"> <a href="<?php bp_activity_comment_user_link(); ?> "> <?php bp_activity_avatar(array('type' => 'thumb', 'user_id' => bp_get_activity_comment_user_id())); ?> </a> </div> <div class="acomment-meta"> <?php /* translators: 1: user profile link, 2: user name, 3: activity permalink, 4: activity timestamp */ printf(__('<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since">%4$s</span></a>', 'buddypress'), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded()); ?> </div> <div class="acomment-content"><?php bp_activity_comment_content(); ?> </div> <div class="acomment-options"> <?php if (is_user_logged_in() && bp_activity_can_comment_reply(bp_activity_current_comment())) { ?> <a href="#acomment-<?php
/** * Truncate long activity entries when viewed in activity streams. * * @since BuddyPress (1.5.0) * * @uses bp_is_single_activity() * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook. * @uses apply_filters() To call the 'bp_activity_excerpt_length' hook. * @uses bp_create_excerpt() * @uses bp_get_activity_id() * @uses bp_get_activity_thread_permalink() * @uses apply_filters() To call the 'bp_activity_truncate_entry' hook. * * @param string $text The original activity entry text. * @return string $excerpt The truncated text. */ function bp_activity_truncate_entry($text) { global $activities_template; // The full text of the activity update should always show on the single activity screen if (bp_is_single_activity()) { return $text; } /** * Filters the appended text for the activity excerpt. * * @since BuddyPress (1.5.0) * * @param string $read_more Internationalized "Read more" text. */ $append_text = apply_filters('bp_activity_excerpt_append_text', __('[Read more]', 'buddypress')); /** * Filters the excerpt length for the activity excerpt. * * @since BuddyPress (1.5.0) * * @param int $excerpt_length Number indicating how many words to trim the excerpt down to. */ $excerpt_length = apply_filters('bp_activity_excerpt_length', 358); // Run the text through the excerpt function. If it's too short, the original text will be // returned. $excerpt = bp_create_excerpt($text, $excerpt_length, array('ending' => __('…', 'buddypress'))); // If the text returned by bp_create_excerpt() is different from the original text (ie it's // been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping // shortcodes, so we have strip them from the $text before the comparison if ($excerpt != strip_shortcodes($text)) { $id = !empty($activities_template->activity->current_comment->id) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id(); $excerpt = sprintf('%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text); } /** * Filters the composite activity excerpt entry. * * @since BuddyPress (1.5.0) * * @param string $excerpt Excerpt text and markup to be displayed. * @param string $text The original activity entry text. * @param string $append_text The final append text applied. */ return apply_filters('bp_activity_truncate_entry', $excerpt, $text, $append_text); }