本文整理汇总了PHP中get_topic_link函数 的典型用法代码示例。如果您正苦于以下问题:PHP get_topic_link函数的具体用法?PHP get_topic_link怎么用?PHP get_topic_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_topic_link函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bb_quote_link
function bb_quote_link($link_text = 'Quote')
{
global $bb, $page, $topic, $forum, $bb_post;
$add = topic_pages_add();
if (!topic_is_open($bb_post->topic_id) || !bb_is_user_logged_in()) {
return;
}
$post_id = get_post_id();
$last_page = get_page_number($topic->topic_posts + $add);
echo '<a href="' . get_topic_link(0, $last_page) . '"e=' . $post_id . '#postform" id="quote_' . $post_id . '">' . __($link_text) . '</a>';
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:11, 代码来源:quote.php
示例2: for_buddypress_prepare_topic
function for_buddypress_prepare_topic($_topic, $topic)
{
// Cast to an array
$_topic = (array) $topic;
// Set the URI
$_topic['topic_uri'] = get_topic_link($_topic['topic_id']);
// Set readable times
$_topic['topic_start_time_since'] = bb_since($_topic['topic_start_time']);
$_topic['topic_time_since'] = bb_since($_topic['topic_time']);
// Set the display names
$_topic['topic_poster_display_name'] = get_user_display_name($_topic['topic_poster']);
$_topic['topic_last_poster_display_name'] = get_user_display_name($_topic['topic_last_poster']);
return $_topic;
}
开发者ID:alvaropereyra, 项目名称:shrekcms, 代码行数:14, 代码来源:buddypress-enable.php
示例3: nm_alert_user_wrote_forum_topic
/**
* Alerts user's friends when they write a new forum topic
*
* @Param: the id of the topic
*
* @author: Joe Hoyle
* @version 1.0
**/
function nm_alert_user_wrote_forum_topic($topicID)
{
$userInfo = wp_get_current_user();
$friendList = new userFriends();
$friends = $friendList->get_friends($userInfo->ID);
if (is_array($friends)) {
$friends = nm_array_invert($friends);
$alert = array();
$alert['content'] = '<a href="' . getProfileLink($userInfo->ID) . '" title="View ' . nm_user_public_name($userInfo->ID) . 's profile">' . nm_user_public_name($userInfo->ID) . '</a> has written a new forum topic: <a href="' . get_topic_link($topicID) . '" title="View ' . get_topic_title($topicID) . '">' . get_topic_title($topicID) . '</a>.';
$alert['type'] = 'forum';
nm_add_alert($friends, $alert);
}
return $topicID;
}
开发者ID:popovdenis, 项目名称:kmst, 代码行数:22, 代码来源:nm-user-alerts.php
示例4: notification_new_post
/**
* Plugin Name: Post Notification
* Plugin Description: Sends an Notification email if there's a new post to an favorite topic. (Modified Version 1.4 with Post Content included in E-Mail)
* Author: Thomas Klaiber
* Author URI: http://thomasklaiber.com/
* Plugin URI: http://thomasklaiber.com/bbpress/post-notification/
* Version: 1.4
*/
function notification_new_post($post_id = 0)
{
global $bbdb, $bb_table_prefix, $topic_id, $bb_current_user;
$all_users = notification_select_all_users();
foreach ($all_users as $userdata) {
if (notification_is_activated($userdata->ID)) {
if (is_user_favorite($userdata->ID, $topic_id)) {
//$topic = get_topic($topic_id);
$message = __("Hello,\n\nA new post on \"%1\$s\" has been added by %2\$s at DHAnswers. \n\nMessage:\n\n%3\$s \n\n%4\$s ");
mail($userdata->user_email, '[DHAnswers] New Post for Favorite Question', sprintf($message, get_topic_title($topic_id), get_user_name($bb_current_user->ID), strip_tags(get_post_text($post_id)), get_topic_link($topic_id)), 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>');
}
}
}
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:22, 代码来源:notification.php
示例5: mod_notification_new_post
function mod_notification_new_post()
{
global $bbdb, $topic_id, $bb_current_user;
$all_moderators = notification_select_all_mods();
$topic = get_topic($topic_id);
$header = 'From: ' . bb_get_option('name') . ' <' . bb_get_option('from_email') . '>';
$header .= 'MIME-Version: 1.0' . "\n";
$header .= 'Content-Type: text/plain; charset="' . BBDB_CHARSET . '"' . "\n";
$header .= 'Content-Transfer-Encoding: 7bit' . "\n";
$subject = '[DHAnswers] New Post';
foreach ($all_moderators as $userdata) {
if (mod_notification_is_activated($userdata->ID)) {
$msg = "Hello,\n\nA new post has been added to \"" . $topic->topic_title . "\" at DHAnswers. \n\n" . get_topic_link($topic_id);
mail($userdata->user_email, $subject, $msg, $header);
}
}
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:17, 代码来源:moderator_notification.php
示例6: tweet_new_topic
function tweet_new_topic($topic_id, $topic_title)
{
global $bb_post;
if ($bb_post) {
// post already exists
} else {
$t_title = get_topic_title($topic_id);
$t_link = get_topic_link($topic_id);
//shorten URL
exec("curl http://is.gd/api.php?longurl=" . $t_link, $shorturl);
$message = "New ? at DHAnswers: " . $t_title . " ({$shorturl['0']})";
if (strlen($message) > 140) {
$message = substr($message, 0, 139) . '…';
}
// New Tweet using Twitter OAuth
// TODO: check return status
bb_post_tweet($message);
}
return $topic_title;
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:20, 代码来源:twitter-notification.php
示例7: topic_icons_label
function topic_icons_label($label)
{
global $topic;
if (bb_is_front() || bb_is_forum() || bb_is_view() || bb_is_tag()) {
$icon_set_name = topic_icons_get_active_icon_set();
$icon_set_url = ICON_SET_URL_BASE . $icon_set_name;
$status = get_active_status_interpreter()->getStatus(bb_get_location(), $topic);
$renderer = get_active_status_renderer();
$image = $renderer->renderStatus($status);
$tooltip = $renderer->renderStatusTooltip($status);
$exists = file_exists(dirname(__FILE__) . '/icon-sets/' . $icon_set_name . '/' . $image);
if (!$exists) {
return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"></a></div> %s'), get_topic_link($topic->topic_id), ICON_SET_URL_BASE . '/empty.png', ICON_WIDTH, ICON_HEIGHT, $tooltip, $label);
} else {
if (strlen($tooltip) > 0) {
return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"><span>%s</span></a></div> %s'), get_topic_link($topic->topic_id), $icon_set_url . '/' . $image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $tooltip, $label);
} else {
return sprintf(__('<div class="topic-icon-image"><a href="%s"><img src="%s" width="%s" height="%s" alt="%s" border="0"></a></div> %s'), get_topic_link($topic->topic_id), $icon_set_url . '/' . $image, ICON_WIDTH, ICON_HEIGHT, $tooltip, $label);
}
}
}
return $label;
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:23, 代码来源:bb-topic-icons.php
示例8: bb_attachments
function bb_attachments($post_id = 0)
{
global $bb_attachments_on_page;
if (isset($bb_attachments_on_page)) {
return;
} else {
$bb_attachments_on_page = true;
}
// only insert once per page -> pre 0.9.0.2
if ($post_id == 0) {
if (isset($_GET['bb_attachments'])) {
$post_id = intval($_GET['bb_attachments']);
} else {
global $bb_post;
$post_id = $bb_post->post_id;
}
}
if ($post_id) {
$bb_post = bb_get_post($post_id);
if (bb_attachments_location() != 'edit.php') {
echo "<h3 class='bbcrumb'><a href='" . bb_get_option('uri') . "'>" . bb_get_option('name') . "</a> » <a href='" . get_topic_link() . "'>" . get_topic_title($bb_post->topic_id) . "</a> » <a href='" . get_post_link($bb_post->post_id) . "'>" . __('Post') . " {$bb_post->post_position}</a> » " . __('Attachments') . "</h3>";
}
echo "<div class='indent'>";
if (isset($_FILES['bb_attachments'])) {
bb_attachments_process_post(intval($_GET['bb_attachments']), 1);
echo "<br />";
}
echo bb_attachments_post_attachments($post_id);
echo "<br />";
bb_attachments_upload_form($post_id);
echo "<br />";
echo "</div>";
}
}
开发者ID:achorg, 项目名称:DH-Answers, 代码行数:34, 代码来源:bb-attachments.php
示例9: bb_auth
<?php
require './bb-load.php';
bb_auth('logged_in');
if (!bb_is_user_logged_in()) {
bb_die(__('You need to be logged in to add a tag.'));
}
$topic_id = (int) @$_POST['id'];
$page = (int) @$_POST['page'];
$tag = @$_POST['tag'];
$tag = stripslashes($tag);
bb_check_admin_referer('add-tag_' . $topic_id);
$topic = get_topic($topic_id);
if (!$topic) {
bb_die(__('Topic not found.'));
}
if (bb_add_topic_tags($topic_id, $tag)) {
wp_redirect(get_topic_link($topic_id, $page));
} else {
bb_die(__('The tag was not added. Either the tag name was invalid or the topic is closed.'));
}
exit;
开发者ID:laiello, 项目名称:cartonbank, 代码行数:22, 代码来源:tag-add.php
示例10: bb_ksd_submit
function bb_ksd_submit($submit, $type = false)
{
global $bb_ksd_api_host;
global $bb_ksd_api_port;
switch ($type) {
case 'ham':
case 'spam':
$path = '/1.1/submit-' . $type;
$bb_post = bb_get_post($submit);
if (!$bb_post) {
return;
}
$user = bb_get_user($bb_post->poster_id);
if (bb_is_trusted_user($user->ID)) {
return;
}
$_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'user_ip' => $bb_post->poster_ip, 'permalink' => get_topic_link($bb_post->topic_id), 'comment_type' => 'forum', 'comment_author' => get_user_name($user->ID), 'comment_author_email' => bb_get_user_email($user->ID), 'comment_author_url' => get_user_link($user->ID), 'comment_content' => $bb_post->post_text, 'comment_date_gmt' => $bb_post->post_time);
break;
case 'hammer':
case 'spammer':
$path = '/1.1/submit-' . substr($type, 0, -3);
$user = bb_get_user($submit);
if (!$user) {
return;
}
if (bb_is_trusted_user($user->ID)) {
return;
}
$_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'permalink' => get_user_profile_link($user->ID), 'comment_type' => 'profile', 'comment_author' => get_user_name($user->ID), 'comment_author_email' => bb_get_user_email($user->ID), 'comment_author_url' => get_user_link($user->ID), 'comment_content' => $user->occ . ' ' . $user->interests, 'comment_date_gmt' => $user->user_registered);
break;
default:
if (bb_is_trusted_user(bb_get_current_user())) {
return;
}
$path = '/1.1/comment-check';
$_submit = array('blog' => bb_get_uri(null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET), 'user_ip' => preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']), 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'referrer' => $_SERVER['HTTP_REFERER'], 'comment_type' => isset($_POST['topic_id']) ? 'forum' : 'profile', 'comment_author' => bb_get_current_user_info('name'), 'comment_author_email' => bb_get_current_user_info('email'), 'comment_author_url' => bb_get_current_user_info('url'), 'comment_content' => $submit);
if (isset($_POST['topic_id'])) {
$_submit['permalink'] = get_topic_link($_POST['topic_id']);
// First page
}
break;
}
$query_string = '';
foreach ($_submit as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
}
return bb_ksd_http_post($query_string, $bb_ksd_api_host, $path, $bb_ksd_api_port);
}
开发者ID:laiello, 项目名称:cartonbank, 代码行数:48, 代码来源:akismet.php
示例11: prepare_topic
/**
* Prepares topic data for return in an XML-RPC object
*
* @since 1.0
* @return array The prepared topic data
* @param array|object The unprepared topic data
**/
function prepare_topic($topic)
{
// Cast to an array
$_topic = (array) $topic;
// Set the URI
$_topic['topic_uri'] = get_topic_link($_topic['topic_id']);
// Set readable times
$_topic['topic_start_time_since'] = bb_since($_topic['topic_start_time']);
$_topic['topic_time_since'] = bb_since($_topic['topic_time']);
// Set the display names
$_topic['topic_poster_display_name'] = get_user_display_name($_topic['topic_poster']);
$_topic['topic_last_poster_display_name'] = get_user_display_name($_topic['topic_last_poster']);
// Remove some sensitive user ids
unset($_topic['topic_poster'], $_topic['topic_last_poster']);
// Allow plugins to modify the data
return apply_filters('bb_xmlrpc_prepare_topic', $_topic, (array) $topic);
}
开发者ID:nxtclass, 项目名称:NXTClass-Plugin, 代码行数:24, 代码来源:xmlrpc.php
示例12: printf
} else {
printf(__('<a href="%1$s">Post</a> on <a href="%2$s">%3$s</a> by %4$s'), esc_attr(add_query_arg('view', 'all', get_post_link())), get_topic_link($bb_post->topic_id), get_topic_title($bb_post->topic_id), get_post_author());
}
?>
</li>
<?php
} elseif ('topic' == $object['type']) {
global $topic;
$topic = $object['data'];
?>
<li>
<?php
if ($topic->topic_poster) {
printf(__('Topic titled <a href="%1$s">%2$s</a> started by <a href="%3$s">%4$s</a>'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_user_profile_link($topic->topic_poster), get_topic_author($topic->topic_id));
} else {
printf(__('Topic titled <a href="%1$s">%2$s</a> started by %3$s'), esc_attr(add_query_arg('view', 'all', get_topic_link())), get_topic_title($topic->topic_id), get_topic_author($topic->topic_id));
}
?>
</li>
<?php
}
}
remove_filter('get_topic_where', 'bb_no_where');
?>
</ul>
<?php
} else {
?>
<p>
<?php
_e('No moderated posts or topics… you must have very well behaved members.');
开发者ID:un1coin, 项目名称:ovn-space, 代码行数:31, 代码来源:index.php
示例13: widget
//.........这里部分代码省略.........
RWLogger::Log('BP_ACTIVITY_HIDE_SITEWIDE');
}
// Activity marked as hidden in site.
continue;
}
}
}
$title = trim(strip_tags($activity->content));
$permalink = bp_activity_get_permalink($id);
} else {
if ('users' === $type) {
$id = RatingWidgetPlugin::Urid2UserId($urid);
if ($bpInstalled) {
$title = trim(strip_tags(bp_core_get_user_displayname($id)));
$permalink = bp_core_get_user_domain($id);
} else {
if ($bbInstalled) {
$title = trim(strip_tags(bbp_get_user_display_name($id)));
$permalink = bbp_get_user_profile_url($id);
} else {
continue;
}
}
} else {
if ('forum_posts' === $type || 'forum_replies' === $type) {
$id = RatingWidgetPlugin::Urid2ForumPostId($urid);
if (function_exists('bp_forums_get_post')) {
$forum_post = @bp_forums_get_post($id);
if (!is_object($forum_post)) {
continue;
}
$title = trim(strip_tags($forum_post->post_text));
$page = bb_get_page_number($forum_post->post_position);
$permalink = get_topic_link($id, $page) . "#post-{$id}";
} else {
if (function_exists('bbp_get_reply_id')) {
$forum_item = bbp_get_topic();
if (is_object($forum_item)) {
$is_topic = true;
} else {
$is_topic = false;
$forum_item = bbp_get_reply($id);
if (!is_object($forum_item)) {
if (RWLogger::IsOn()) {
RWLogger::Log('BBP_FORUM_ITEM_NOT_EXIST', $id);
}
// Invalid id (no topic nor reply).
continue;
}
if (RWLogger::IsOn()) {
RWLogger::Log('BBP_IS_TOPIC_REPLY', $is_topic ? 'FALSE' : 'TRUE');
}
}
// Visible statueses: Public or Closed.
$visible_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
if (!in_array($forum_item->post_status, $visible_statuses)) {
if (RWLogger::IsOn()) {
RWLogger::Log('BBP_FORUM_ITEM_HIDDEN', $forum_item->post_status);
}
// Item is not public nor closed.
continue;
}
$is_reply = !$is_topic;
if ($is_reply) {
// Get parent topic.
$forum_topic = bbp_get_topic($forum_post->post_parent);
开发者ID:AlexOreshkevich, 项目名称:velomode.by, 代码行数:67, 代码来源:rw-top-rated-widget.php
示例14: switch
default:
switch ($status) {
case 0:
$message = 'unspammed-normal';
break;
case 1:
$message = 'unspammed-deleted';
break;
default:
break;
}
break;
}
$topic = get_topic($bb_post->topic_id);
if ($sendto = wp_get_referer()) {
$sendto = remove_query_arg('message', $sendto);
$sendto = add_query_arg('message', $message, $sendto);
$send_to_topic = bb_get_topic_from_uri($sendto);
if ($send_to_topic && $topic->topic_id == $send_to_topic->topic_id) {
$sendto = add_query_arg('view', 'all', $sendto);
}
} else {
if ($topic->topic_posts == 0) {
$sendto = get_forum_link($topic->forum_id);
} else {
$the_page = bb_get_page_number($bb_post->post_position);
$sendto = get_topic_link($bb_post->topic_id, $the_page);
}
}
bb_safe_redirect($sendto);
exit;
开发者ID:danielcoats, 项目名称:schoolpress, 代码行数:31, 代码来源:delete-post.php
示例15: widget
function widget($args, $instance)
{
if (RWLogger::IsOn()) {
$params = func_get_args();
RWLogger::LogEnterence("RWTopRated.widget", $params, true);
}
if (!defined("WP_RW__USER_KEY") || false === WP_RW__USER_KEY) {
return;
}
if (RatingWidgetPlugin::$WP_RW__HIDE_RATINGS) {
return;
}
extract($args, EXTR_SKIP);
$types = array("posts" => array("rclass" => "blog-post", "classes" => "front-post,blog-post,new-blog-post,user-post", "options" => WP_RW__BLOG_POSTS_OPTIONS), "pages" => array("rclass" => "page", "classes" => "page,user-page", "options" => WP_RW__PAGES_OPTIONS), "comments" => array("rclass" => "comment", "classes" => "comment,new-blog-comment,user-comment", "options" => WP_RW__COMMENTS_OPTIONS), "activity_updates" => array("rclass" => "activity-update", "classes" => "activity-update,user-activity-update", "options" => WP_RW__ACTIVITY_UPDATES_OPTIONS), "activity_comments" => array("rclass" => "activity-comment", "classes" => "activity-comment,user-activity-comment", "options" => WP_RW__ACTIVITY_COMMENTS_OPTIONS), "forum_posts" => array("rclass" => "forum-post", "classes" => "forum-post,new-forum-post,user-forum-post", "options" => WP_RW__FORUM_POSTS_OPTIONS), "users" => array("rclass" => "user", "classes" => "user", "options" => WP_RW__FORUM_POSTS_OPTIONS));
$show_any = false;
foreach ($types as $type => $data) {
if (false !== $instance["show_{$type}"]) {
$show_any = true;
break;
}
}
if (false === $show_any) {
// Nothing to show.
return;
}
$details = array("uid" => WP_RW__USER_KEY);
$queries = array();
foreach ($types as $type => $type_data) {
if ($instance["show_{$type}"] && $instance["{$type}_count"] > 0) {
$options = json_decode(RatingWidgetPlugin::_getOption($type_data["options"]));
$queries[$type] = array("rclasses" => $type_data["classes"], "votes" => max(1, (int) $instance["{$type}_min_votes"]), "orderby" => $instance["{$type}_orderby"], "order" => $instance["{$type}_order"], "limit" => (int) $instance["{$type}_count"], "types" => isset($options->type) ? $options->type : "star");
}
}
$details["queries"] = urlencode(json_encode($queries));
$rw_ret_obj = RatingWidgetPlugin::RemoteCall("action/query/ratings.php", $details);
if (false === $rw_ret_obj) {
return;
}
$rw_ret_obj = json_decode($rw_ret_obj);
if (null === $rw_ret_obj || true !== $rw_ret_obj->success) {
return;
}
echo $before_widget;
$title = empty($instance['title']) ? __('Top Rated', WP_RW__ID) : apply_filters('widget_title', $instance['title']);
echo $before_title . $title . $after_title;
$empty = true;
if (count($rw_ret_obj->data) > 0) {
foreach ($rw_ret_obj->data as $type => $ratings) {
if (is_array($ratings) && count($ratings) > 0) {
echo '<div id="rw_top_rated_' . $type . '">';
if ($instance["show_{$type}_title"]) {
/* (1.3.3) - Conditional title display */
$instance["{$type}_title"] = empty($instance["{$type}_title"]) ? ucwords($type) : $instance["{$type}_title"];
echo '<p style="margin: 0;">' . $instance["{$type}_title"] . '</p>';
}
echo '<ul class="rw-top-rated-list">';
foreach ($ratings as $rating) {
$urid = $rating->urid;
$rclass = $types[$type]["rclass"];
RatingWidgetPlugin::QueueRatingData($urid, "", "", $rclass);
switch ($type) {
case "posts":
case "pages":
$id = RatingWidgetPlugin::Urid2PostId($urid);
$post = get_post($id);
$title = trim(strip_tags($post->post_title));
$permalink = get_permalink($post->ID);
break;
case "comments":
$id = RatingWidgetPlugin::Urid2CommentId($urid);
$comment = get_comment($id);
$title = trim(strip_tags($comment->comment_content));
$permalink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
break;
case "activity_updates":
case "activity_comments":
$id = RatingWidgetPlugin::Urid2ActivityId($urid);
$activity = new bp_activity_activity($id);
$title = trim(strip_tags($activity->content));
$permalink = bp_activity_get_permalink($id);
break;
case "users":
$id = RatingWidgetPlugin::Urid2UserId($urid);
$title = trim(strip_tags(bp_core_get_user_displayname($id)));
$permalink = bp_core_get_user_domain($id);
break;
case "forum_posts":
$id = RatingWidgetPlugin::Urid2ForumPostId($urid);
$forum_post = bp_forums_get_post($id);
$title = trim(strip_tags($forum_post->post_text));
$page = bb_get_page_number($forum_post->post_position);
$permalink = get_topic_link($id, $page) . "#post-{$id}";
break;
}
$short = mb_strlen($title) > 30 ? trim(mb_substr($title, 0, 30)) . "..." : $title;
echo '<li>' . '<a href="' . $permalink . '" title="' . $title . '">' . $short . '</a>' . '<br />' . '<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . '"></div>' . '</li>';
}
echo "</ul>";
echo "</div>";
$empty = false;
//.........这里部分代码省略.........
开发者ID:ugurbastan, 项目名称:swe-574-group4, 代码行数:101, 代码来源:rating-widget.php
示例16: bb_check_admin_referer
}
$fav = (int) $_GET['fav'];
$topic_id = (int) $_GET['topic_id'];
bb_check_admin_referer('toggle-favorite_' . $topic_id);
$topic = get_topic($topic_id);
if (!$topic || 0 != $topic->topic_status) {
exit;
}
if ($fav) {
bb_add_user_favorite($user_id, $topic_id);
} else {
bb_remove_user_favorite($user_id, $topic_id);
}
$ref = wp_get_referer();
if (false !== strpos($ref, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT))) {
bb_safe_redirect($ref);
} else {
wp_redirect(get_topic_link($topic_id));
}
exit;
}
if (!bb_is_profile()) {
$sendto = get_profile_tab_link($user->ID, 'favorites');
wp_redirect($sendto);
exit;
}
if ($topics = get_user_favorites($user->ID, true)) {
bb_cache_last_posts($topics);
}
$favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0;
bb_load_template('favorites.php', array('favorites_total', 'self'));
开发者ID:danielcoats, 项目名称:schoolpress, 代码行数:31, 代码来源:favorites.php
示例17: get_topic
<?php
require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
$super = isset($_GET['super']) && 1 == (int) $_GET['super'] ? 1 : 0;
if (!$topic) {
bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('stick_topic', $topic_id)) {
wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
exit;
}
bb_check_admin_referer('stick-topic_' . $topic_id);
if (topic_is_sticky($topic_id)) {
bb_unstick_topic($topic_id);
} else {
bb_stick_topic($topic_id, $super);
}
if (!($redirect = wp_get_referer())) {
$redirect = get_topic_link($topic_id);
}
bb_safe_redirect($redirect);
exit;
开发者ID:danielcoats, 项目名称:schoolpress, 代码行数:24, 代码来源:sticky.php
示例18: GetTopRated
public function GetTopRated()
{
$rw_ret_obj = $this->GetTopRatedData(array('posts', 'pages'));
if (false === $rw_ret_obj || count($rw_ret_obj->data) == 0) {
return '';
}
$html = '<div id="rw_top_rated_page">';
foreach ($rw_ret_obj->data as $type => $ratings) {
if (is_array($ratings) && count($ratings) > 0) {
$html .= '<div id="rw_top_rated_page_' . $type . '" class="rw-wp-ui-top-rated-list-container">';
if ($instance["show_{$type}_title"]) {
$instance["{$type}_title"] = empty($instance["{$type}_title"]) ? ucwords($type) : $instance["{$type}_title"];
$html .= '<p style="margin: 0;">' . $instance["{$type}_title"] . '</p>';
}
$html .= '<ul class="rw-wp-ui-top-rated-list">';
$count = 1;
foreach ($ratings as $rating) {
$urid = $rating->urid;
$rclass = $types[$type]["rclass"];
$thumbnail = '';
ratingwidget()->QueueRatingData($urid, "", "", $rclass);
switch ($type) {
case "posts":
case "pages":
$id = RatingWidgetPlugin::Urid2PostId($urid);
$post = get_post($id);
$title = trim(strip_tags($post->post_title));
$excerpt = $this->GetPostExcerpt($post, 15);
$permalink = get_permalink($post->ID);
$thumbnail = $this->GetPostFeaturedImage($post->ID);
break;
case "comments":
$id = RatingWidgetPlugin::Urid2CommentId($urid);
$comment = get_comment($id);
$title = trim(strip_tags($comment->comment_content));
$permalink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
break;
case "activity_updates":
case "activity_comments":
$id = RatingWidgetPlugin::Urid2ActivityId($urid);
$activity = new bp_activity_activity($id);
$title = trim(strip_tags($activity->content));
$permalink = bp_activity_get_permalink($id);
break;
case "users":
$id = RatingWidgetPlugin::Urid2UserId($urid);
$title = trim(strip_tags(bp_core_get_user_displayname($id)));
$permalink = bp_core_get_user_domain($id);
break;
case "forum_posts":
$id = RatingWidgetPlugin::Urid2ForumPostId($urid);
$forum_post = bp_forums_get_post($id);
$title = trim(strip_tags($forum_post->post_text));
$page = bb_get_page_number($forum_post->post_position);
$permalink = get_topic_link($id, $page) . "#post-{$id}";
break;
}
$short = mb_strlen($title) > 30 ? trim(mb_substr($title, 0, 30)) . "..." : $title;
$html .= '
<li class="rw-wp-ui-top-rated-list-item">
<div>
<b class="rw-wp-ui-top-rated-list-count">' . $count . '</b>
<img class="rw-wp-ui-top-rated-list-item-thumbnail" src="' . $thumbnail . '" alt="" />
<div class="rw-wp-ui-top-rated-list-item-data">
<div>
<a class="rw-wp-ui-top-rated-list-item-title" href="' . $permalink . '" title="' . $title . '">' . $short . '</a>
<div class="rw-ui-container rw-class-' . $rclass . ' rw-urid-' . $urid . ' rw-size-small rw-prop-readOnly-true"></div>
</div>
<p class="rw-wp-ui-top-rated-list-item-excerpt">' . $excerpt . '</p>
</div>
</div>
</li>';
$count++;
}
$html .= "</ul>";
$html .= "</div>";
}
}
// Set a flag that the widget is loaded.
RatingWidgetPlugin::TopRatedWidgetLoaded();
ob_start();
?>
<script type="text/javascript">
// Hook render widget.
if (typeof(RW_HOOK_READY) === "undefined"){ RW_HOOK_READY = []; }
RW_HOOK_READY.push(function(){
RW._foreach(RW._getByClassName("rw-wp-ui-top-rated-list", "ul"), function(list){
RW._foreach(RW._getByClassName("rw-ui-container", "div", list), function(rating){
// Deactivate rating.
RW._Class.remove(rating, "rw-active");
var i = (RW._getByClassName("rw-report-link", "a", rating))[0];
if (RW._is(i)){ i.parentNode.removeChild(i); }
});
});
});
</script>
<?php
$html .= ob_get_clean();
$html .= '</div>';
return $html;
//.........这里部分代码省略.........
开发者ID:panser, 项目名称:wandromaha, 代码行数:101, 代码来源:rating-widget.php
示例19: foreach
foreach ($topics as $topic) {
$posts[] = bb_get_first_post($topic->topic_id);
}
$title = esc_html(sprintf(__('%1$s » View: %2$s'), bb_get_option('name'), $bb_views[$feed_id]['title']));
$link = get_view_link($feed_id);
$link_self = bb_get_view_rss_link($feed_id);
break;
case 'topic':
if (!($topic = get_topic($feed_id))) {
die;
}
if (!($posts = get_thread($feed_id, 0, 1))) {
die;
}
$title = esc_html(sprintf(__('%1$s » Topic: %2$s'), bb_get_option('name'), get_topic_title()));
$link = get_topic_link($feed_id);
$link_self = get_topic_rss_link($feed_id);
break;
case 'profile':
if (bb_get_option('mod_rewrite') === 'slugs') {
$user = bb_get_user_by_nicename($feed_id);
} else {
$user = bb_get_user($feed_id);
}
if (!$user) {
die;
}
if (!($posts = get_user_favorites($user->ID))) {
die;
}
$title = esc_html(sprintf(__('%1$s » User Favorites: %2$s'), bb_get_option('name'), $user->user_login));
开发者ID:abc2mit, 项目名称:abc2mit.github.io, 代码行数:31, 代码来源:rss.php
示例20: best_answer_post_link
一、系统的z变换和反变换 1、利用部分分式展开求解逆Z变换: 2、例子 3、Z变换的MATLA
阅读:540| 2022-07-18
krishnaik06/Machine-Learning-in-90-days
阅读:1121| 2022-08-18
HTML injection vulnerability in secure messages of Devolutions Server before 202
阅读:1338| 2022-07-08
armancodv/building-energy-model-matlab: It is a small software which is develope
阅读:1167| 2022-08-17
FGRibreau/import-tweets-to-mastodon: How to import tweets to mastodon (e.g. http
阅读:974| 2022-08-17
tboronczyk/localization-middleware: PSR-15 middleware to assist primarily with l
阅读:521| 2022-08-16
臣的笔顺怎么写?臣的笔顺笔画顺序是什么?解析臣字的笔画顺序怎么写了解到好多的写字朋
阅读:565| 2022-07-30
dotnet/MobileBlazorBindings: Experimental Mobile Blazor Bindings - Build native
阅读:438| 2022-08-29
池的笔顺怎么写?池的笔顺笔画顺序是什么?中国练字网了解到好多人在学习中会遇到池的笔
阅读:942| 2022-11-06
heinrichreimer/material-intro: A simple material design app intro with cool anim
阅读:427| 2022-08-17
请发表评论