当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_get_reply_permalink函数代码示例

本文整理汇总了PHP中bbp_get_reply_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply_permalink函数的具体用法?PHP bbp_get_reply_permalink怎么用?PHP bbp_get_reply_permalink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_get_reply_permalink函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_bbp_get_reply_permalink

 /**
  * @covers ::bbp_reply_permalink
  * @covers ::bbp_get_reply_permalink
  */
 public function test_bbp_get_reply_permalink()
 {
     if (is_multisite()) {
         $this->markTestSkipped('Skipping URL tests in multiste for now.');
     }
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $reply_permalink = bbp_get_reply_permalink($r);
     $this->expectOutputString($reply_permalink);
     bbp_reply_permalink($r);
     $this->assertSame('http://' . WP_TESTS_DOMAIN . '/?reply=' . bbp_get_reply_id($r), $reply_permalink);
 }
开发者ID:ntwb,项目名称:bbPress,代码行数:17,代码来源:reply.php

示例2: bbp_get_topic_last_reply_permalink

/**
 * Return the link to the last reply in a topic
 *
 * @since 2.0.0 bbPress (r2464)
 *
 * @param int $topic_id Optional. Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_topic_last_reply_id() To get the topic last reply id
 * @uses bbp_get_reply_permalink() To get the reply permalink
 * @uses apply_filters() Calls 'bbp_get_topic_last_topic_permalink' with
 *                        the reply permalink and topic id
 * @return string Permanent link to the reply
 */
function bbp_get_topic_last_reply_permalink($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    $reply_id = bbp_get_topic_last_reply_id($topic_id);
    $retval = bbp_get_reply_permalink($reply_id);
    return apply_filters('bbp_get_topic_last_reply_permalink', $retval, $topic_id, $reply_id);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:20,代码来源:template.php

示例3: bbp_get_breadcrumb


//.........这里部分代码省略.........
        $pre_current_text = bbp_get_reply_title();
        // Topic Tag (or theme compat topic tag)
    } elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag') && !bbp_is_topic_tag_edit()) {
        // Always include the tag name
        $tag_data[] = bbp_get_topic_tag_name();
        // If capable, include a link to edit the tag
        if (current_user_can('manage_topic_tags')) {
            $tag_data[] = '<a href="' . bbp_get_topic_tag_edit_link() . '" class="bbp-edit-topic-tag-link">' . __('(Edit)', 'bbpress') . '</a>';
        }
        // Implode the results of the tag data
        $pre_current_text = sprintf(__('Topic Tag: %s', 'bbpress'), implode(' ', $tag_data));
        // Edit Topic Tag
    } elseif (bbp_is_topic_tag_edit()) {
        $pre_current_text = __('Edit', 'bbpress');
        // Single
    } else {
        $pre_current_text = get_the_title();
    }
    /** Parse Args ********************************************************/
    // Parse args
    $defaults = array('before' => '<div class="bbp-breadcrumb"><p>', 'after' => '</p></div>', 'sep' => __('&rsaquo;', 'bbpress'), 'pad_sep' => 1, 'include_home' => $pre_include_home, 'home_text' => $pre_front_text, 'include_root' => $pre_include_root, 'root_text' => $pre_root_text, 'include_current' => $pre_include_current, 'current_text' => $pre_current_text);
    $r = bbp_parse_args($args, $defaults, 'get_breadcrumb');
    extract($r);
    /** Ancestors *********************************************************/
    // Get post ancestors
    if (is_page() || is_single() || bbp_is_forum_edit() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
        $ancestors = array_reverse(get_post_ancestors(get_the_ID()));
    }
    // Do we want to include a link to home?
    if (!empty($include_home) || empty($home_text)) {
        $crumbs[] = '<a href="' . trailingslashit(home_url()) . '" class="bbp-breadcrumb-home">' . $home_text . '</a>';
    }
    // Do we want to include a link to the forum root?
    if (!empty($include_root) || empty($root_text)) {
        // Page exists at root slug path, so use its permalink
        $page = bbp_get_page_by_path(bbp_get_root_slug());
        if (!empty($page)) {
            $root_url = get_permalink($page->ID);
            // Use the root slug
        } else {
            $root_url = get_post_type_archive_link(bbp_get_forum_post_type());
        }
        // Add the breadcrumb
        $crumbs[] = '<a href="' . $root_url . '" class="bbp-breadcrumb-root">' . $root_text . '</a>';
    }
    // Ancestors exist
    if (!empty($ancestors)) {
        // Loop through parents
        foreach ((array) $ancestors as $parent_id) {
            // Parents
            $parent = get_post($parent_id);
            // Switch through post_type to ensure correct filters are applied
            switch ($parent->post_type) {
                // Forum
                case bbp_get_forum_post_type():
                    $crumbs[] = '<a href="' . bbp_get_forum_permalink($parent->ID) . '" class="bbp-breadcrumb-forum">' . bbp_get_forum_title($parent->ID) . '</a>';
                    break;
                    // Topic
                // Topic
                case bbp_get_topic_post_type():
                    $crumbs[] = '<a href="' . bbp_get_topic_permalink($parent->ID) . '" class="bbp-breadcrumb-topic">' . bbp_get_topic_title($parent->ID) . '</a>';
                    break;
                    // Reply (Note: not in most themes)
                // Reply (Note: not in most themes)
                case bbp_get_reply_post_type():
                    $crumbs[] = '<a href="' . bbp_get_reply_permalink($parent->ID) . '" class="bbp-breadcrumb-reply">' . bbp_get_reply_title($parent->ID) . '</a>';
                    break;
                    // WordPress Post/Page/Other
                // WordPress Post/Page/Other
                default:
                    $crumbs[] = '<a href="' . get_permalink($parent->ID) . '" class="bbp-breadcrumb-item">' . get_the_title($parent->ID) . '</a>';
                    break;
            }
        }
        // Edit topic tag
    } elseif (bbp_is_topic_tag_edit()) {
        $crumbs[] = '<a href="' . get_term_link(bbp_get_topic_tag_id(), bbp_get_topic_tag_tax_id()) . '" class="bbp-breadcrumb-topic-tag">' . sprintf(__('Topic Tag: %s', 'bbpress'), bbp_get_topic_tag_name()) . '</a>';
    }
    /** Current ***********************************************************/
    // Add current page to breadcrumb
    if (!empty($include_current) || empty($pre_current_text)) {
        $crumbs[] = '<span class="bbp-breadcrumb-current">' . $current_text . '</span>';
    }
    /** Separator *********************************************************/
    // Wrap the separator in a span before padding and filter
    if (!empty($sep)) {
        $sep = '<span class="bbp-breadcrumb-separator">' . $sep . '</span>';
    }
    // Pad the separator
    if (!empty($pad_sep)) {
        $sep = str_pad($sep, strlen($sep) + (int) $pad_sep * 2, ' ', STR_PAD_BOTH);
    }
    /** Finish Up *********************************************************/
    // Filter the separator and breadcrumb
    $sep = apply_filters('bbp_breadcrumb_separator', $sep);
    $crumbs = apply_filters('bbp_breadcrumbs', $crumbs);
    // Build the trail
    $trail = !empty($crumbs) ? $before . implode($sep, $crumbs) . $after : '';
    return apply_filters('bbp_get_breadcrumb', $trail, $crumbs, $r);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-common-template.php

示例4: bbp_get_reply_edit_url

/**
 * Return URL to the reply edit page
 *
 * @since bbPress (r2753)
 *
 * @param int $reply_id Optional. Reply id
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_get_reply_edit_url' with the edit
 *                        url and reply id
 * @return string Reply edit url
 */
function bbp_get_reply_edit_url($reply_id = 0)
{
    global $wp_rewrite;
    $bbp = bbpress();
    $reply = bbp_get_reply(bbp_get_reply_id($reply_id));
    if (empty($reply)) {
        return;
    }
    $reply_link = bbp_remove_view_all(bbp_get_reply_permalink($reply_id));
    // Pretty permalinks
    if ($wp_rewrite->using_permalinks()) {
        $url = trailingslashit($reply_link) . $bbp->edit_id;
        $url = trailingslashit($url);
        // Unpretty permalinks
    } else {
        $url = add_query_arg(array(bbp_get_reply_post_type() => $reply->post_name, $bbp->edit_id => '1'), $reply_link);
    }
    // Maybe add view all
    $url = bbp_add_view_all($url);
    return apply_filters('bbp_get_reply_edit_url', $url, $reply_id);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:35,代码来源:template.php

示例5: bbp_get_forum_last_reply_permalink

/**
 * Return the link to the last reply in a forum
 *
 * @since bbPress (r2464)
 *
 * @param int $forum_id Optional. Forum id
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_last_reply_id() To get the forum's last reply id
 * @uses bbp_get_reply_permalink() To get the reply permalink
 * @uses apply_filters() Calls 'bbp_get_forum_last_reply_permalink' with
 *                        the reply link and forum id
 * @return string Permanent link to the forum's last reply
 */
function bbp_get_forum_last_reply_permalink($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    return apply_filters('bbp_get_forum_last_reply_permalink', bbp_get_reply_permalink(bbp_get_forum_last_reply_id($forum_id)), $forum_id);
}
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:bbp-forum-template.php

示例6: bbp_get_reply_edit_url

/**
 * Return URL to the reply edit page
 *
 * @since 2.0.0 bbPress (r2753)
 *
 * @param int $reply_id Optional. Reply id
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_get_reply_edit_url' with the edit
 *                        url and reply id
 * @return string Reply edit url
 */
function bbp_get_reply_edit_url($reply_id = 0)
{
    $reply = bbp_get_reply($reply_id);
    if (empty($reply)) {
        return;
    }
    $reply_link = bbp_remove_view_all(bbp_get_reply_permalink($reply_id));
    // Pretty permalinks
    if (bbp_use_pretty_urls()) {
        $url = trailingslashit($reply_link) . bbp_get_edit_rewrite_id();
        $url = user_trailingslashit($url);
        // Unpretty permalinks
    } else {
        $url = add_query_arg(array(bbp_get_reply_post_type() => $reply->post_name, bbp_get_edit_rewrite_id() => '1'), $reply_link);
    }
    // Maybe add view all
    $url = bbp_add_view_all($url);
    return apply_filters('bbp_get_reply_edit_url', $url, $reply_id);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:33,代码来源:template.php

示例7: bbp_get_forum_last_reply_permalink

/**
 * Return the link to the last reply in a forum
 *
 * @since 2.0.0 bbPress (r2464)
 *
 * @param int $forum_id Optional. Forum id
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_last_reply_id() To get the forum's last reply id
 * @uses bbp_get_reply_permalink() To get the reply permalink
 * @uses apply_filters() Calls 'bbp_get_forum_last_reply_permalink' with
 *                        the reply link and forum id
 * @return string Permanent link to the forum's last reply
 */
function bbp_get_forum_last_reply_permalink($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    $reply_id = bbp_get_forum_last_reply_id($forum_id);
    $link = bbp_get_reply_permalink($reply_id);
    return apply_filters('bbp_get_forum_last_reply_permalink', $link, $forum_id, $reply_id);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:20,代码来源:template.php

示例8: bbp_get_topic_last_reply_permalink

/**
 * Return the link to the last reply in a topic
 *
 * @since bbPress (r2464)
 *
 * @param int $topic_id Optional. Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_topic_last_reply_id() To get the topic last reply id
 * @uses bbp_get_reply_permalink() To get the reply permalink
 * @uses apply_filters() Calls 'bbp_get_topic_last_topic_permalink' with
 *                        the reply permalink and topic id
 * @return string Permanent link to the reply
 */
function bbp_get_topic_last_reply_permalink($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    return apply_filters('bbp_get_topic_last_reply_permalink', bbp_get_reply_permalink(bbp_get_topic_last_reply_id($topic_id)));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:18,代码来源:template.php

示例9: _build_email

 /**
  * @since 1.4
  */
 private function _build_email($type, $post_id)
 {
     $email_subject = get_option("bbpress_notify_new{$type}_email_subject");
     $email_body = get_option("bbpress_notify_new{$type}_email_body");
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $excerpt_size = apply_filters('bpnns_excerpt_size', 100);
     // Replace shortcodes
     if ('topic' === $type) {
         $content = bbp_get_topic_content($post_id);
         $title = html_entity_decode(strip_tags(bbp_get_topic_title($post_id)), ENT_NOQUOTES, 'UTF-8');
         $excerpt = html_entity_decode(strip_tags(bbp_get_topic_excerpt($post_id, $excerpt_size)), ENT_NOQUOTES, 'UTF-8');
         $author = bbp_get_topic_author($post_id);
         $url = apply_filters('bbpnns_topic_url', bbp_get_topic_permalink($post_id), $post_id, $title);
         $forum = html_entity_decode(strip_tags(get_the_title(bbp_get_topic_forum_id($post_id))), ENT_NOQUOTES, 'UTF-8');
     } elseif ('reply' === $type) {
         $content = bbp_get_reply_content($post_id);
         $title = html_entity_decode(strip_tags(bbp_get_reply_title($post_id)), ENT_NOQUOTES, 'UTF-8');
         $excerpt = html_entity_decode(strip_tags(bbp_get_reply_excerpt($post_id, $excerpt_size)), ENT_NOQUOTES, 'UTF-8');
         $author = bbp_get_reply_author($post_id);
         $url = apply_filters('bbpnns_reply_url', bbp_get_reply_permalink($post_id), $post_id, $title);
         $forum = html_entity_decode(strip_tags(get_the_title(bbp_get_reply_forum_id($post_id))), ENT_NOQUOTES, 'UTF-8');
     } else {
         wp_die('Invalid type!');
     }
     $content = preg_replace('/<br\\s*\\/?>/is', PHP_EOL, $content);
     $content = preg_replace('/(?:<\\/p>\\s*<p>)/ism', PHP_EOL . PHP_EOL, $content);
     $content = html_entity_decode(strip_tags($content), ENT_NOQUOTES, 'UTF-8');
     $topic_reply = apply_filters('bbpnns_topic_reply', bbp_get_reply_url($post_id), $post_id, $title);
     $email_subject = str_replace('[blogname]', $blogname, $email_subject);
     $email_subject = str_replace("[{$type}-title]", $title, $email_subject);
     $email_subject = str_replace("[{$type}-content]", $content, $email_subject);
     $email_subject = str_replace("[{$type}-excerpt]", $excerpt, $email_subject);
     $email_subject = str_replace("[{$type}-author]", $author, $email_subject);
     $email_subject = str_replace("[{$type}-url]", $url, $email_subject);
     $email_subject = str_replace("[{$type}-replyurl]", $topic_reply, $email_subject);
     $email_subject = str_replace("[{$type}-forum]", $forum, $email_subject);
     $email_body = str_replace('[blogname]', $blogname, $email_body);
     $email_body = str_replace("[{$type}-title]", $title, $email_body);
     $email_body = str_replace("[{$type}-content]", $content, $email_body);
     $email_body = str_replace("[{$type}-excerpt]", $excerpt, $email_body);
     $email_body = str_replace("[{$type}-author]", $author, $email_body);
     $email_body = str_replace("[{$type}-url]", $url, $email_body);
     $email_body = str_replace("[{$type}-replyurl]", $topic_reply, $email_body);
     $email_body = str_replace("[{$type}-forum]", $forum, $email_body);
     /**
      * Allow subject and body modifications
      * @since 1.6.6
      */
     $email_subject = apply_filters('bbpnns_filter_email_subject_in_build', $email_subject, $type, $post_id);
     $email_body = apply_filters('bbpnns_filter_email_body_in_build', $email_body, $type, $post_id);
     return array($email_subject, $email_body);
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:55,代码来源:bbpress-notify-nospam.php

示例10: test_bbp_get_topic_last_reply_permalink

 /**
  * @covers ::bbp_topic_last_reply_permalink
  * @covers ::bbp_get_topic_last_reply_permalink
  */
 public function test_bbp_get_topic_last_reply_permalink()
 {
     if (is_multisite()) {
         $this->markTestSkipped('Skipping URL tests in multiste for now.');
     }
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $topic_last_reply_permalink = bbp_get_topic_last_reply_permalink($f);
     $this->assertSame(bbp_get_topic_permalink($t), $topic_last_reply_permalink);
     $r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $topic_last_reply_permalink = bbp_get_topic_last_reply_permalink($f);
     $this->assertSame(bbp_get_reply_permalink($r), $topic_last_reply_permalink);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:17,代码来源:get-last-thing.php


注:本文中的bbp_get_reply_permalink函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。