本文整理汇总了PHP中BP_Activity_Activity::get_recorded_components方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Activity_Activity::get_recorded_components方法的具体用法?PHP BP_Activity_Activity::get_recorded_components怎么用?PHP BP_Activity_Activity::get_recorded_components使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Activity_Activity
的用法示例。
在下文中一共展示了BP_Activity_Activity::get_recorded_components方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_recorded_components_skip_last_activity_true_la_in_multiple_components
/**
* @group get_recorded_components
*/
public function test_get_recorded_components_skip_last_activity_true_la_in_multiple_components()
{
$a1 = $this->factory->activity->create(array('component' => 'members', 'action' => 'last_activity'));
$a2 = $this->factory->activity->create(array('component' => 'groups', 'action' => 'created_group'));
$a3 = $this->factory->activity->create(array('component' => 'friends', 'action' => 'friendship_accepted'));
$a4 = $this->factory->activity->create(array('component' => 'groups', 'action' => 'last_activity'));
$found = BP_Activity_Activity::get_recorded_components(true);
sort($found);
$this->assertSame(array('friends', 'groups'), BP_Activity_Activity::get_recorded_components());
}
示例2: bp_get_activity_filter_links
/**
* Return the activity filter links.
*
* @since 1.1.0
*
* @param array $args Defaults to false
*
* @global object $activities_template {@link BP_Activity_Template}
* @global object $bp BuddyPress global settings
* @uses nxt_parse_args()
* @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
* @uses esc_attr()
* @uses add_query_arg()
* @uses remove_query_arg()
* @uses apply_filters() To call the 'bp_get_activity_filter_link_href' hook
* @uses apply_filters() To call the 'bp_get_activity_filter_links' hook
*
* @return string|bool $component_links The activity filter links. False on failure
*/
function bp_get_activity_filter_links($args = false)
{
global $activities_template, $bp;
$defaults = array('style' => 'list');
$r = nxt_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
// Fetch the names of components that have activity recorded in the DB
$components = BP_Activity_Activity::get_recorded_components();
if (!$components) {
return false;
}
foreach ((array) $components as $component) {
/* Skip the activity comment filter */
if ('activity' == $component) {
continue;
}
if (isset($_GET['afilter']) && $component == $_GET['afilter']) {
$selected = ' class="selected"';
} else {
unset($selected);
}
$component = esc_attr($component);
switch ($style) {
case 'list':
$tag = 'li';
$before = '<li id="afilter-' . $component . '"' . $selected . '>';
$after = '</li>';
break;
case 'paragraph':
$tag = 'p';
$before = '<p id="afilter-' . $component . '"' . $selected . '>';
$after = '</p>';
break;
case 'span':
$tag = 'span';
$before = '<span id="afilter-' . $component . '"' . $selected . '>';
$after = '</span>';
break;
}
$link = add_query_arg('afilter', $component);
$link = remove_query_arg('acpage', $link);
$link = apply_filters('bp_get_activity_filter_link_href', $link, $component);
// Make sure all core internal component names are translatable
$translatable_components = array(__('xprofile', 'buddypress'), __('friends', 'buddypress'), __('groups', 'buddypress'), __('status', 'buddypress'), __('sites', 'buddypress'));
$component_links[] = $before . '<a href="' . esc_attr($link) . '">' . ucwords(__($component, 'buddypress')) . '</a>' . $after;
}
$link = remove_query_arg('afilter', $link);
if (isset($_GET['afilter'])) {
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_attr($link) . '">' . __('Clear Filter', 'buddypress') . '</a></' . $tag . '>';
}
return apply_filters('bp_get_activity_filter_links', implode("\n", $component_links));
}
示例3: form
//.........这里部分代码省略.........
?>
_yes" name="<?php
echo $this->get_field_name('show_activity_filters');
?>
" type="radio" <?php
if ($show_activity_filters == 'yes') {
echo "checked='checked'";
}
?>
value="yes" style="width: 10%" />Yes</label>
<label for="<?php
echo $this->get_field_id('show_activity_filters');
?>
_no" > <input id="<?php
echo $this->get_field_id('show_activity_filters');
?>
_no" name="<?php
echo $this->get_field_name('show_activity_filters');
?>
" type="radio" <?php
if ($show_activity_filters !== 'yes') {
echo "checked='checked'";
}
?>
value="no" style="width: 10%" />No</label>
</label>
</p>
<p><label for="bp-swa-included-filters"><strong><?php
_e('Include only following Filters:', 'swa');
?>
</strong></label></p>
<p> <?php
$recorded_components = BP_Activity_Activity::get_recorded_components();
foreach ((array) $recorded_components as $component) {
?>
<label for="<?php
echo $this->get_field_id('included_components') . '_' . $component;
?>
" ><?php
echo ucwords($component);
?>
<input id="<?php
echo $this->get_field_id('included_components') . '_' . $component;
?>
" name="<?php
echo $this->get_field_name('included_components');
?>
[]" type="checkbox" <?php
if (is_array($included_components) && in_array($component, $included_components)) {
echo "checked='checked'";
}
?>
value="<?php
echo $component;
?>
" style="width: 10%" /></label>
<?php
}
?>
</p>
<p><label for="bp-swa-included-filters"><strong><?php
_e('Exclude following Components activity', 'swa');
?>
示例4: bp_get_activity_filter_links
/**
* Return the activity filter links.
*
* @since BuddyPress (1.1.0)
*
* @uses wp_parse_args()
* @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity}
* @uses esc_attr()
* @uses add_query_arg()
* @uses remove_query_arg()
* @uses apply_filters() To call the 'bp_get_activity_filter_link_href' hook.
* @uses apply_filters() To call the 'bp_get_activity_filter_links' hook.
*
* @param array $args {
* @type string $style The type of markup to use for the links.
* 'list', 'paragraph', or 'span'. Default: 'list'.
* }
* @return string|bool $component_links The activity filter links.
* False on failure.
*/
function bp_get_activity_filter_links($args = false)
{
$defaults = array('style' => 'list');
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
// Define local variable
$component_links = array();
// Fetch the names of components that have activity recorded in the DB
$components = BP_Activity_Activity::get_recorded_components();
if (empty($components)) {
return false;
}
foreach ((array) $components as $component) {
// Skip the activity comment filter
if ('activity' == $component) {
continue;
}
if (isset($_GET['afilter']) && $component == $_GET['afilter']) {
$selected = ' class="selected"';
} else {
unset($selected);
}
$component = esc_attr($component);
switch ($style) {
case 'list':
$tag = 'li';
$before = '<li id="afilter-' . $component . '"' . $selected . '>';
$after = '</li>';
break;
case 'paragraph':
$tag = 'p';
$before = '<p id="afilter-' . $component . '"' . $selected . '>';
$after = '</p>';
break;
case 'span':
$tag = 'span';
$before = '<span id="afilter-' . $component . '"' . $selected . '>';
$after = '</span>';
break;
}
$link = add_query_arg('afilter', $component);
$link = remove_query_arg('acpage', $link);
/**
* Filters the activity filter link URL for the current activity component.
*
* @since BuddyPress (1.1.0)
*
* @param string $link The URL for the current component.
* @param string $component The current component getting links constructed for.
*/
$link = apply_filters('bp_get_activity_filter_link_href', $link, $component);
$component_links[] = $before . '<a href="' . esc_url($link) . '">' . ucwords($component) . '</a>' . $after;
}
$link = remove_query_arg('afilter', $link);
if (isset($_GET['afilter'])) {
$component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . esc_url($link) . '">' . __('Clear Filter', 'buddypress') . '</a></' . $tag . '>';
}
/**
* Filters all of the constructed filter links.
*
* @since BuddyPress (1.1.0)
*
* @param string $value All of the links to be displayed to the user.
*/
return apply_filters('bp_get_activity_filter_links', implode("\n", $component_links));
}
示例5: swa_get_base_component_scope
function swa_get_base_component_scope($include, $exclude)
{
/* Fetch the names of components that have activity recorded in the DB */
$components = BP_Activity_Activity::get_recorded_components();
if (!empty($include)) {
$components = explode(",", $include);
}
//array of component names
if (!empty($exclude)) {
//exclude all the
$components = array_diff((array) $components, explode(",", $exclude));
//diff of exclude/recorded components
}
return $components;
}