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


PHP bb_get_topic_tags函数代码示例

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


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

示例1: bfox_bp_activity_before_save

/**
 * Calculates the bible references for an activity before it is saved
 *
 * @param $activity
 */
function bfox_bp_activity_before_save($activity)
{
    global $bp;
    // For blog posts, index the full post content and tags
    if ($activity->component == $bp->blogs->id && $activity->type == 'new_blog_post') {
        switch_to_blog($activity->item_id);
        $ref = bfox_blog_post_get_ref($activity->secondary_item_id);
        restore_current_blog();
    } elseif ($activity->component == $bp->groups->id && ($activity->type == 'new_forum_post' || $activity->type == 'new_forum_topic')) {
        // Get the forum post
        if ($activity->type == 'new_forum_topic') {
            list($post) = bp_forums_get_topic_posts(array('topic_id' => $activity->secondary_item_id, 'per_page' => 1));
        } else {
            $post = bp_forums_get_post($activity->secondary_item_id);
        }
        // Index the post text
        $ref = bfox_ref_from_content($post->post_text);
        // Only index the tags for the first post in a topic
        if ($activity->type == 'new_forum_topic') {
            $tags = bb_get_topic_tags($post->topic_id, array('fields' => 'names'));
            foreach ($tags as $tag) {
                $ref->add_ref(bfox_ref_from_tag($tag));
            }
        }
    } else {
        $ref = bfox_ref_from_content($activity->content);
    }
    // Add any 'Bible Tag' read passage strings
    if ('activity_update' == $activity->type && isset($_REQUEST['bfox_read_ref_str'])) {
        $tag_ref = new BfoxRef($_REQUEST['bfox_read_ref_str']);
        if ($tag_ref->is_valid()) {
            $activity->bfox_read_ref_str = $tag_ref->get_string();
            $activity->action = str_replace('posted an update', __('posted an update about ', 'bfox') . $activity->bfox_read_ref_str, $activity->action);
            $ref->add_ref($tag_ref);
        }
    }
    if ($ref->is_valid()) {
        $activity->bfox_ref = $ref;
    }
}
开发者ID:jeffryevans,项目名称:biblefox-wp,代码行数:45,代码来源:activity.php

示例2: __construct

 /**
  * Constructor method.
  *
  * @param int $topic_id ID of the topic whose posts are being requested.
  * @param int $per_page Number of items to return per page.
  * @param int $max Max records to return.
  * @param string $order Direction to order results.
  */
 function __construct($topic_id, $per_page, $max, $order)
 {
     global $bp, $current_user, $forum_template;
     if (!isset($forum_template)) {
         $forum_template = new stdClass();
     }
     $this->pag_page = isset($_REQUEST['topic_page']) ? intval($_REQUEST['topic_page']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     $this->order = $order;
     $this->topic_id = $topic_id;
     $forum_template->topic = (object) bp_forums_get_topic_details($this->topic_id);
     $this->forum_id = $forum_template->topic->forum_id;
     $this->posts = bp_forums_get_topic_posts(array('topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order));
     if (!$this->posts) {
         $this->post_count = 0;
         $this->total_post_count = 0;
     } else {
         if (!$max || $max >= (int) $forum_template->topic->topic_posts) {
             $this->total_post_count = (int) $forum_template->topic->topic_posts;
         } else {
             $this->total_post_count = (int) $max;
         }
         if ($max) {
             if ($max >= count($this->posts)) {
                 $this->post_count = count($this->posts);
             } else {
                 $this->post_count = (int) $max;
             }
         } else {
             $this->post_count = count($this->posts);
         }
     }
     // Load topic tags
     $this->topic_tags = bb_get_topic_tags($this->topic_id);
     $this->pag = new stdClass();
     if ((int) $this->total_post_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg(array('topic_page' => '%#%', 'num' => (int) $this->pag_num)), 'format' => '', 'total' => ceil((int) $this->total_post_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => _x('←', 'Forum thread pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Forum thread pagination next text', 'buddypress'), 'mid_size' => 1));
         $this->pag->total_pages = ceil((int) $this->total_post_count / (int) $this->pag_num);
     } else {
         $this->pag->total_pages = 1;
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:50,代码来源:bp-forums-template.php

示例3: get_socialit

function get_socialit()
{
    global $socialit_plugopts, $bbdb, $public_tags, $socialit_is_mobile, $socialit_is_bot;
    $dont_get_si = false;
    $topic = get_topic(get_topic_id());
    if (class_exists('Support_Forum') && $topic) {
        //compatibility with Support Forum plugin for bbPress
        $support_forum = new Support_Forum();
        if ($support_forum->isActive() && in_array($topic->forum_id, $support_forum->enabled)) {
            if ($socialit_plugopts['sfpnonres'] == "no" && $support_forum->getTopicStatus() == "no" || $socialit_plugopts['sfpres'] == "no" && $support_forum->getTopicStatus() == "yes" || $socialit_plugopts['sfpnonsup'] == "no" && $support_forum->getTopicStatus() == "mu") {
                $dont_get_si = true;
            }
        }
    }
    if ($socialit_plugopts['mobile-hide'] == 'yes' && ($socialit_is_mobile || $socialit_is_bot)) {
        $dont_get_si = true;
    }
    if (bb_is_topic() && bb_get_topicmeta($topic->topic_id, 'hide_socialit') == true) {
        $dont_get_si = true;
    }
    if (!$dont_get_si) {
        if (bb_is_topic()) {
            $perms = urlencode(get_topic_link());
            $title = get_topic_title();
            $feedperms = strtolower($perms);
            // Grab post tags for Twittley tags. If there aren't any, use default tags set in plugin options page
            $get_tags = bb_get_topic_tags(get_topic_id());
            if ($get_tags) {
                foreach ($get_tags as $tag) {
                    $keywords = $keywords . $tag->name . ',';
                }
            }
            $topic_id_ft = get_topic_id();
            //topic id for getting text
            $first_post = (int) $bbdb->get_var("SELECT post_id FROM {$bbdb->posts} WHERE topic_id = {$topic_id_ft} ORDER BY post_id ASC LIMIT 1");
            $socialit_content = get_post_text($first_post);
        } else {
            $perms = socialit_get_current_url();
            $title = bb_get_title();
            $feedperms = strtolower($perms);
            $socialit_content = bb_get_option('description');
        }
        if (strlen($title) >= 80) {
            $short_title = urlencode(substr($title, 0, 80) . "[..]");
        } else {
            $short_title = urlencode($title);
        }
        $title = urlencode($title);
        $site_name = bb_get_option('name');
        $socialit_content = urlencode(substr(strip_tags(strip_shortcodes($socialit_content)), 0, 300));
        $socialit_content = socialit_change_plus_apos($socialit_content);
        $mail_subject = socialit_change_plus_apos($title);
        $post_summary = stripslashes($socialit_content);
        if (!empty($keywords)) {
            $d_tags = $keywords;
        } else {
            $d_tags = $socialit_plugopts['defaulttags'];
        }
        $site_name = bb_get_option('name');
        $y_cat = $socialit_plugopts['ybuzzcat'];
        $y_med = $socialit_plugopts['ybuzzmed'];
        $t_cat = $socialit_plugopts['twittcat'];
        $short_url = socialit_get_fetch_url();
        $current_rss_link = socialit_get_current_rss_link();
        // Temporary fix for bug that breaks layout when using NextGen Gallery plugin
        if (strpos($post_summary, '[') || strpos($post_summary, ']')) {
            $post_summary = "";
        }
        if (strpos($socialit_content, '[') || strpos($socialit_content, ']')) {
            $socialit_content = "";
        }
        // select the background
        if (!isset($socialit_plugopts['bgimg-yes'])) {
            $bgchosen = '';
        } elseif ($socialit_plugopts['bgimg'] == 'sexy') {
            $bgchosen = ' social-it-bg-sexy';
        } elseif ($socialit_plugopts['bgimg'] == 'caring') {
            $bgchosen = ' social-it-bg-caring';
        } elseif ($socialit_plugopts['bgimg'] == 'care-old') {
            $bgchosen = ' social-it-bg-caring-old';
        } elseif ($socialit_plugopts['bgimg'] == 'love') {
            $bgchosen = ' social-it-bg-love';
        } elseif ($socialit_plugopts['bgimg'] == 'wealth') {
            $bgchosen = ' social-it-bg-wealth';
        } elseif ($socialit_plugopts['bgimg'] == 'enjoy') {
            $bgchosen = ' social-it-bg-enjoy';
        }
        $style = $socialit_plugopts['autocenter'] ? '' : ' style="' . __($socialit_plugopts['xtrastyle']) . '"';
        $isfeed = bb_is_feed();
        if ($isfeed) {
            $style = '';
        }
        // do not add inline styles to the feed.
        $expand = $socialit_plugopts['expand'] ? ' social-it-expand' : '';
        if ($socialit_plugopts['autocenter'] == 1) {
            $autocenter = ' social-it-center';
        } elseif ($socialit_plugopts['autocenter'] == 2) {
            $autocenter = ' social-it-spaced';
        } else {
            $autocenter = '';
//.........这里部分代码省略.........
开发者ID:achorg,项目名称:DH-Answers,代码行数:101,代码来源:functions.php

示例4: bb_getTopicTags

 /**
  * Returns the tags in a given topic or all tags
  *
  * @since 1.0
  * @return integer|object The tag data when successfully executed or an IXR_Error object on failure
  * @param array $args Arguments passed by the XML-RPC call
  * @param string $args[0] The username for authentication
  * @param string $args[1] The password for authentication
  * @param integer|string $args[2] The topic id or slug (optional)
  *
  * XML-RPC request to get all tags in the topic with slug "woot-frist-topic"
  * <methodCall>
  *     <methodName>bb.getTopicTags</methodName>
  *     <params>
  *         <param><value><string>joeblow</string></value></param>
  *         <param><value><string>123password</string></value></param>
  *         <param><value><string>woot-frist-topic</string></value></param>
  *     </params>
  * </methodCall>
  */
 function bb_getTopicTags($args)
 {
     do_action('bb_xmlrpc_call', 'bb.getTopicTags');
     // Escape args
     $this->escape($args);
     // Get the login credentials
     $username = $args[0];
     $password = (string) $args[1];
     // Check the user is valid
     if ($this->auth_readonly) {
         $user = $this->authenticate($username, $password);
     }
     do_action('bb_xmlrpc_call_authenticated', 'bb.getTopicTags');
     // If an error was raised by authentication or by an action then return it
     if ($this->error) {
         return $this->error;
     }
     // Can be numeric id or slug
     $topic_id = isset($args[2]) ? $args[2] : false;
     // Check for bad data
     if ($topic_id) {
         if (!is_string($topic_id) && !is_integer($topic_id)) {
             $this->error = new IXR_Error(400, __('The topic id is invalid.'));
             return $this->error;
         }
         // Check the requested topic exists
         if (!($topic = get_topic($topic_id))) {
             $this->error = new IXR_Error(400, __('No topic found.'));
             return $this->error;
         }
         // The topic id may have been a slug, so make sure it's an integer here
         $topic_id = (int) $topic->topic_id;
         // Now get the tags
         if (!($tags = bb_get_topic_tags($topic_id))) {
             $this->error = new IXR_Error(500, __('No topic tags found.'));
             return $this->error;
         }
     } else {
         global $nxt_taxonomy_object;
         $tags = $nxt_taxonomy_object->get_terms('bb_topic_tag', array('get' => 'all'));
         if (is_nxt_error($tags)) {
             $this->error = new IXR_Error(500, __('Could not retrieve all topic tags.'));
             return $this->error;
         }
         for ($i = 0; isset($tags[$i]); $i++) {
             _bb_make_tag_compat($tags[$i]);
         }
     }
     // Only include "safe" data in the array
     $_tags = array();
     foreach ($tags as $tag) {
         $_tags[] = $this->prepare_topic_tag($tag);
     }
     do_action('bb_xmlrpc_call_return', 'bb.getTopicTags');
     // Return the tags
     return $_tags;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:77,代码来源:xmlrpc.php

示例5: bb_get_public_tags

function bb_get_public_tags($topic_id)
{
    $tags = bb_get_topic_tags($topic_id);
    if (!is_array($tags)) {
        return;
    }
    $used_tags = array();
    $public_tags = array();
    foreach ($tags as $tag) {
        if (!in_array($tag->tag_id, $used_tags)) {
            $public_tags[] = $tag;
            $used_tags[] = $tag->tag_id;
        }
    }
    return $public_tags;
}
开发者ID:hscale,项目名称:webento,代码行数:16,代码来源:functions.bb-topic-tags.php

示例6: get_topic_tags

function get_topic_tags($topic_id)
{
    bb_log_deprecated('function', __FUNCTION__, 'bb_get_topic_tags');
    return bb_get_topic_tags($topic_id);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:5,代码来源:functions.bb-deprecated.php

示例7: bb_list_tags

function bb_list_tags($args = null)
{
    $defaults = array('tags' => false, 'format' => 'list', 'topic' => 0, 'list_id' => 'tags-list');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    if (!($topic = get_topic(get_topic_id($topic)))) {
        return false;
    }
    if (!is_array($tags)) {
        $tags = bb_get_topic_tags($topic->topic_id);
    }
    if (!$tags) {
        return false;
    }
    $list_id = esc_attr($list_id);
    $r = '';
    switch (strtolower($format)) {
        case 'table':
            break;
        case 'list':
        default:
            $args['format'] = 'list';
            $r .= '<ul id="' . $list_id . '" class="tags-list list:tag">' . "\n";
            foreach ($tags as $tag) {
                $r .= _bb_list_tag_item($tag, $args);
            }
            $r .= '</ul>';
            break;
    }
    echo $r;
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:31,代码来源:functions.bb-template.php

示例8: _e

<div id="topic-tags">
<p><?php 
_e('Tags:');
?>
</p>

<?php 
if (bb_get_topic_tags()) {
    ?>

<?php 
    bb_list_tags();
    ?>

<?php 
} else {
    ?>

<p><?php 
    printf(__('No <a href="%s">tags</a> yet.'), bb_get_tag_page_link());
    ?>
</p>

<?php 
}
?>

<?php 
tag_form();
?>
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:30,代码来源:topic-tags.php

示例9: bb_export_topic_tags

function bb_export_topic_tags($r, $topic_id)
{
    global $topic_tag_cache;
    if (!get_topic($topic_id)) {
        return;
    }
    if (!($tags = bb_get_topic_tags($topic_id))) {
        return $r;
    }
    $r .= "\n";
    foreach ((array) $tags as $tag) {
        $r .= bb_export_tag($tag);
    }
    $topic_tag_cache = array();
    return $r;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:16,代码来源:export.php

示例10: bb_repermalink

}
bb_repermalink();
if (!$topic) {
    bb_die(__('Topic not found.'));
}
if ($view_deleted) {
    add_filter('get_thread_where', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
    add_filter('get_thread_post_ids', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
    add_filter('post_edit_uri', 'bb_make_link_view_all');
}
$bb_db_override = false;
do_action('bb_topic.php_pre_db', $topic_id);
if (!$bb_db_override) {
    $posts = get_thread($topic_id, $page);
    $forum = bb_get_forum($topic->forum_id);
    $tags = bb_get_topic_tags($topic_id);
    if ($tags && ($bb_current_id = bb_get_current_user_info('id'))) {
        $user_tags = bb_get_user_tags($topic_id, $bb_current_id);
        $other_tags = bb_get_other_tags($topic_id, $bb_current_id);
        $public_tags = bb_get_public_tags($topic_id);
    } elseif (is_array($tags)) {
        $user_tags = false;
        $other_tags = bb_get_public_tags($topic_id);
        $public_tags =& $other_tags;
    } else {
        $user_tags = $other_tags = $public_tags = false;
    }
    $list_start = ($page - 1) * bb_get_option('page_topics') + 1;
    bb_post_author_cache($posts);
}
bb_load_template('topic.php', array('bb_db_override', 'user_tags', 'other_tags', 'list_start'), $topic_id);
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:topic.php


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