本文整理汇总了PHP中Comment::get_relative_individual_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::get_relative_individual_permalink方法的具体用法?PHP Comment::get_relative_individual_permalink怎么用?PHP Comment::get_relative_individual_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::get_relative_individual_permalink方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
case 'comments':
$url = get_user_uri($current_user->user_login, 'conversation');
do_redirection($url);
exit(0);
case 'friends':
$url = get_user_uri($current_user->user_login, 'friends_new');
do_redirection($url);
exit(0);
case 'post':
$url = 'http://' . get_server_name() . post_get_base_url($id);
do_redirection($url);
exit(0);
case 'comment':
$c = new Comment();
$c->id = $id;
$url = 'http://' . get_server_name() . $c->get_relative_individual_permalink();
do_redirection($url);
exit(0);
default:
$l = Link::from_db($id, null, false);
if (!$l) {
exit(0);
}
if (!$globals['mobile'] && !$globals['mobile_version'] && $current_user->user_id > 0 && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
if ($globals['base_bar_url']) {
$url = $globals['base_url'] . $globals['base_bar_url'] . $id;
} else {
$url = $globals['base_url'] . "bar.php?id={$id}";
}
do_redirection($url, 307);
} else {
示例2: exit
case 'comments':
$url = get_user_uri($current_user->user_login, 'conversation');
do_redirection($url);
exit(0);
case 'friends':
$url = get_user_uri($current_user->user_login, 'friends_new');
do_redirection($url);
exit(0);
case 'post':
$url = $globals['scheme'] . '//' . get_server_name() . post_get_base_url($id);
do_redirection($url);
exit(0);
case 'comment':
$c = new Comment();
$c->id = $id;
$url = $globals['scheme'] . '//' . get_server_name() . $c->get_relative_individual_permalink();
do_redirection($url);
exit(0);
default:
$l = Link::from_db($id, null, false);
if (!$l) {
exit(0);
}
if (!$globals['mobile'] && !$globals['mobile_version'] && !empty($l->url) && $current_user->user_id > 0 && (empty($globals['https']) || preg_match('/^https:/', $l->url)) && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
$url = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'b/' . $id;
// we use always http to load no https pages
do_redirection($url, 307);
} else {
if (empty($l->url)) {
$url = $l->get_permalink();
} else {
示例3: Comment
include 'config.php';
include mnminclude . 'html1.php';
$page_size = $globals['page_size'] * 3;
$comment = new Comment();
if (!isset($_REQUEST['id']) && $globals['base_comment_url'] && $_SERVER['PATH_INFO']) {
$url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
array_shift($url_args);
// The first element is always a "/"
$comment->id = intval($url_args[0]);
} else {
$url_args = preg_split('/\\/+/', $_REQUEST['id']);
$comment->id = intval($url_args[0]);
if ($comment->id > 0 && $globals['base_comment_url']) {
// Redirect to the right URL if the link has a "semantic" uri
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $comment->get_relative_individual_permalink());
die;
}
}
if (!$comment->read()) {
do_error(_('comentario no encontrado'), 404);
}
$link = Link::from_db($comment->link, null, false);
if ($link->is_discarded()) {
$globals['ads'] = false;
$globals['noindex'] = true;
}
$globals['link'] = $link;
$globals['permalink'] = 'http://' . get_server_name() . $comment->get_relative_individual_permalink();
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
示例4: do_best_comments
function do_best_comments()
{
global $db, $globals, $dblang;
if ($globals['mobile']) {
return;
}
$foo = new Comment();
$output = '';
$key = 'best_comments_' . $globals['css_main'];
if (memcache_mprint($key)) {
return;
}
$min_date = date("Y-m-d H:i:00", $globals['now'] - 43000);
// about 12 hours
$link_min_date = date("Y-m-d H:i:00", $globals['now'] - 86400);
// 24 hours
$now = intval($globals['now'] / 60) * 60;
// The order is not exactly the comment_karma
// but a time-decreasing function applied to the number of votes
$res = $db->get_results("select comment_id, comment_order, user_id, user_login, user_avatar, link_id, link_uri, link_title, link_comments, comment_karma*(1-({$now}-unix_timestamp(comment_date))*0.7/43000) as value, link_negatives/link_votes as rel from comments, links, users where link_date > '{$link_min_date}' and comment_date > '{$min_date}' and link_negatives/link_votes < 0.5 and comment_karma > 50 and comment_link_id = link_id and comment_user_id = user_id order by value desc limit 12");
if ($res) {
$output .= '<div class="sidebox"><div class="header"><h4><a href="' . $globals['base_url'] . 'topcomments.php">' . _('mejores comentarios') . '</a></h4></div><div class="comments"><ul>' . "\n";
foreach ($res as $comment) {
$foo->id = $comment->comment_id;
$link = $foo->get_relative_individual_permalink();
$output .= '<li><img src="' . get_avatar_url($comment->user_id, $comment->user_avatar, 20) . '" alt="" width="20" height="20" class="avatar"/>';
$output .= '<p><strong>' . $comment->user_login . '</strong> ' . _('en') . ' <a onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $comment->comment_id . '\', 10000);" href="' . $link . '">' . $comment->link_title . '</a></p></li>' . "\n";
}
$output .= '</ul></div></div>';
echo $output;
memcache_madd($key, $output, 300);
}
}
示例5: do_best_comments
function do_best_comments()
{
global $db, $globals, $dblang;
if ($globals['mobile'] || $globals['bot']) {
return;
}
$foo = new Comment();
$output = '';
$key = 'best_comments_' . $globals['site_shortname'] . $globals['v'];
if (memcache_mprint($key)) {
return;
}
echo '<!-- Calculating ' . __FUNCTION__ . ' -->';
$min_date = date("Y-m-d H:i:00", $globals['now'] - 50000);
// about 12 hours
$link_min_date = date("Y-m-d H:i:00", $globals['now'] - 86400 * 2);
// 48 hours
$now = intval($globals['now'] / 60) * 60;
// The order is not exactly the comment_karma
// but a time-decreasing function applied to the number of votes
$res = $db->get_results("select comment_id, comment_order, user_id, user_login, user_avatar, link_id, link_uri, link_title, link_comments, comment_karma*(1-({$now}-unix_timestamp(comment_date))*0.7/43000) as value, link_negatives/link_votes as rel from comments, links, users, sub_statuses where id = " . SitesMgr::my_id() . " AND status in ('published', 'queued') AND link_id = link AND date > '{$link_min_date}' and comment_date > '{$min_date}' and LENGTH(comment_content) > 32 and link_negatives/link_votes < 0.5 and comment_karma > 50 and comment_link_id = link and comment_user_id = user_id and user_level != 'disabled' order by value desc limit 10");
if ($res) {
$objects = array();
$title = _('mejores comentarios');
$url = $globals['base_url'] . 'top_comments';
foreach ($res as $comment) {
$obj = new stdClass();
$obj->id = $foo->id = $comment->comment_id;
$obj->link = $foo->get_relative_individual_permalink();
$obj->user_id = $comment->user_id;
$obj->avatar = $comment->user_avatar;
$obj->title = $comment->link_title;
$obj->username = $comment->user_login;
$obj->tooltip = 'c';
$objects[] = $obj;
}
$vars = compact('objects', 'title', 'url');
$output = Haanga::Load('best_comments_posts.html', $vars, true);
echo $output;
memcache_madd($key, $output, 300);
}
}
示例6: print_answers
//do_subheader(_('comentario de') . ' ' . $username);
/*** SIDEBAR ****/
echo '<div id="sidebar">';
do_banner_right();
//do_best_stories();
do_best_comments();
do_banner_promotions();
echo '</div>' . "\n";
/*** END SIDEBAR ***/
echo '<div id="newswrap"><!-- comment.php -->' . "\n";
echo '<h3 style="text-shadow: 0 1px #ccc"><a href="' . $link->get_permalink() . '">' . $link->title . '</a></h3>';
echo '<ol class="comments-list">';
echo '<li>';
$comment->print_summary($link, 0, false);
echo '<div style="text-align:right">';
$vars = array('link' => 'http://' . get_server_name() . $comment->get_relative_individual_permalink(), 'title' => $title);
Haanga::Load('share.html', $vars);
echo '</div>';
echo "</li>\n";
echo "</ol>\n";
print_answers($comment->id, 1);
Comment::print_form($link, 8);
echo '</div>';
// Show the error if the comment couldn't be inserted
if (!empty($new_comment_error)) {
add_javascript('mDialog.notify("' . _('Aviso') . ": {$new_comment_error}" . '", 5);');
}
do_footer();
exit(0);
function print_answers($id, $level, $visited = false)
{
示例7: Comment
include mnminclude . 'html1.php';
$globals['ads'] = true;
$page_size = 50;
$comment = new Comment();
if (!isset($_REQUEST['id']) && $globals['base_comment_url'] && $_SERVER['PATH_INFO']) {
$url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
array_shift($url_args);
// The first element is always a "/"
$comment->id = intval($url_args[0]);
} else {
$url_args = preg_split('/\\/+/', $_REQUEST['id']);
$comment->id = intval($url_args[0]);
if ($comment->id > 0 && $globals['base_comment_url']) {
// Redirect to the right URL if the link has a "semantic" uri
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $comment->get_relative_individual_permalink());
die;
}
}
if (!$comment->read()) {
do_error(_('comentario no encontrado'), 404);
}
$link = new Link();
$link->id = $comment->link;
$link->read();
$globals['link'] = $link;
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
$globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']);
}
// Check for comment post