/** * Echoes the output of bp_docs_get_displayed_user_docs_edited_link() * * @package BuddyPress_Docs * @since 1.9 */ function bp_docs_displayed_user_docs_edited_link() { echo bp_docs_get_displayed_user_docs_edited_link(); }
/** * Get an archive link for a given tag * * Optional arguments: * - 'tag' The tag linked to. This one is required * - 'type' 'html' returns a link; anything else returns a URL * - 'tags' The selected tags * * @param array $args Optional arguments * @return array $filters */ function bp_docs_get_tag_link_multitag($args = array()) { global $bp; $defaults = array('tag' => false, 'type' => 'html', 'tags' => array()); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (bp_is_user()) { $current_action = bp_current_action(); $item_docs_url = bp_displayed_user_domain() . bp_docs_get_docs_slug() . '/'; if (empty($current_action) || BP_DOCS_STARTED_SLUG == $current_action) { $item_docs_url = bp_docs_get_displayed_user_docs_started_link(); } elseif (BP_DOCS_EDITED_SLUG == $current_action) { $item_docs_url = bp_docs_get_displayed_user_docs_edited_link(); } } elseif (bp_is_active('groups') && ($current_group = groups_get_current_group())) { /* * Pass the group object to bp_get_group_permalink() so that it works * when $groups_template may not be set, like during AJAX requests. */ $item_docs_url = trailingslashit(bp_get_group_permalink($current_group) . bp_docs_get_docs_slug()); } else { $item_docs_url = bp_docs_get_archive_link(); } $bdp_tags = $tags; if (in_array($tag, $bdp_tags)) { // Remove because tag is selected $tag_key = array_search($tag, $bdp_tags); if ($tag_key !== FALSE) { unset($bdp_tags[$tag_key]); } } else { $bdp_tags[] = urlencode($tag); } if (!empty($_REQUEST['bool'])) { $item_docs_url = add_query_arg('bool', $_REQUEST['bool'], $item_docs_url); } else { /* * If not exist boolean argument, default add "and" condition */ $item_docs_url = add_query_arg('bool', 'and', $item_docs_url); } $bdp_tags = implode(',', array_filter($bdp_tags)); $url = apply_filters('bp_docs_get_tag_link_url', add_query_arg('bpd_tag', $bdp_tags, $item_docs_url), $args, $item_docs_url); if ($type != 'html') { return apply_filters('bp_docs_get_tag_link_url', $url, $tag, $type); } $html = '<a href="' . $url . '" title="' . sprintf(__('Docs tagged %s', 'bp-docs'), esc_attr($tag)) . '">' . esc_html($tag) . '</a>'; return apply_filters('bp_docs_get_tag_link', $html, $url, $tag, $type); }
/** * Get an archive link for a given tag * * Optional arguments: * - 'tag' The tag linked to. This one is required * - 'type' 'html' returns a link; anything else returns a URL * * @since 1.0-beta * * @param array $args Optional arguments * @return array $filters */ function bp_docs_get_tag_link($args = array()) { global $bp; $defaults = array('tag' => false, 'type' => 'html'); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (bp_is_user()) { $current_action = bp_current_action(); $item_docs_url = bp_displayed_user_domain() . bp_docs_get_docs_slug() . '/'; if (empty($current_action) || BP_DOCS_STARTED_SLUG == $current_action) { $item_docs_url = bp_docs_get_displayed_user_docs_started_link(); } elseif (BP_DOCS_EDITED_SLUG == $current_action) { $item_docs_url = bp_docs_get_displayed_user_docs_edited_link(); } } elseif (bp_is_active('groups') && ($current_group = groups_get_current_group())) { /* * Pass the group object to bp_get_group_permalink() so that it works * when $groups_template may not be set, like during AJAX requests. */ $item_docs_url = trailingslashit(bp_get_group_permalink($current_group) . bp_docs_get_docs_slug()); } else { $item_docs_url = bp_docs_get_archive_link(); } $url = apply_filters('bp_docs_get_tag_link_url', add_query_arg('bpd_tag', urlencode($tag), $item_docs_url), $args, $item_docs_url); if ($type != 'html') { return apply_filters('bp_docs_get_tag_link_url', $url, $tag, $type); } $html = '<a href="' . $url . '" title="' . sprintf(__('Docs tagged %s', 'bp-docs'), esc_attr($tag)) . '">' . esc_html($tag) . '</a>'; return apply_filters('bp_docs_get_tag_link', $html, $url, $tag, $type); }
/** * On user Doc directories, modify the pagination base so that pagination * works within the directory. * * @package BuddyPress_Docs * @subpackage Users * @since 1.9.0 */ public function filter_bp_docs_page_links_base_url($base_url, $wp_rewrite_pag_base) { if (bp_is_user()) { $current_action = bp_current_action(); if ($current_action == BP_DOCS_STARTED_SLUG) { $base_url = user_trailingslashit(bp_docs_get_displayed_user_docs_started_link() . $wp_rewrite_pag_base . '/%#%/'); } elseif ($current_action == BP_DOCS_EDITED_SLUG) { $base_url = user_trailingslashit(bp_docs_get_displayed_user_docs_edited_link() . $wp_rewrite_pag_base . '/%#%/'); } } return $base_url; }