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


PHP Content::get_trackbacks_for_content方法代码示例

本文整理汇总了PHP中Content::get_trackbacks_for_content方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::get_trackbacks_for_content方法的具体用法?PHP Content::get_trackbacks_for_content怎么用?PHP Content::get_trackbacks_for_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Content的用法示例。


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

示例1: uihelper_generate_center_content_permalink

function uihelper_generate_center_content_permalink($cid, $show = 0)
{
    global $app;
    $image_media_gallery = FALSE;
    $back_page = PA::$url . $app->current_route;
    $content = Content::load_content((int) $cid, (int) PA::$login_uid);
    // filter content fields for output
    $content->title = _out($content->title);
    $content->body = _out($content->body);
    if (strstr($back_page, PA_ROUTE_CONTENT) || strstr($back_page, PA_ROUTE_PERMALINK)) {
        if ($content->parent_collection_id > 0) {
            $collection = ContentCollection::load_collection((int) $content->parent_collection_id, PA::$login_uid);
            if ($collection->type == GROUP_COLLECTION_TYPE) {
                $back_page = PA::$url . PA_ROUTE_GROUP . "/gid=" . $content->parent_collection_id;
            } else {
                $back_page = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid=" . $content->author_id;
            }
            // IF permalink content is a group content redirect to group homepage
        } else {
            //if coming from permalink page then redirect to user page
            $back_page = PA::$url . PA_ROUTE_USER_PRIVATE;
        }
    }
    $moderateduser = Group::is_admin((int) $content->parent_collection_id, (int) PA::$login_uid) ? 1 : 0;
    $back_page = urlencode($back_page);
    if (!$content->is_html) {
        $content->body = nl2br($content->body);
    }
    $media_gallery_content = NULL;
    $media_gallery_content = in_array(trim($content->type), array('Image', 'Audio', 'Video'));
    $editable = PA::$login_uid == $content->author_id || $moderateduser;
    $comments = Comment::get_comment_for_content($cid, '', 'ASC');
    $number_of_comments = count($comments);
    $content->no_of_comments = $number_of_comments;
    $trackback = Content::get_trackbacks_for_content($cid);
    $number_of_trackbacks = count($trackback);
    $content->no_of_trackbacks = $number_of_trackbacks;
    $content->trackback_url = PA::$url . "/pa_trackback.php?cid=" . $cid;
    $content_user = new User();
    $content_user->load((int) $content->author_id);
    $content->create_time = PA::date($content->changed, 'long');
    // date("l, F d, Y", $content->changed);
    $tags = Tag::load_tags_for_content($cid);
    if ($tags) {
        $t = array();
        for ($i = 0; $i < count($tags); $i++) {
            $name = _out($tags[$i]['name']);
            $uid = PA::$login_uid;
            $url = PA::$url . '/' . FILE_TAG_SEARCH . '?name_string=content_tag&keyword=' . $tags[$i]["name"];
            $t[] = "<a href={$url}>" . $name . "</a>";
        }
        $tag_string = "<b>Tags : </b>" . implode(", ", $t);
    } else {
        $tag_string = "";
    }
    $content->tag_entry = $tag_string;
    if (property_exists($content, 'sbname')) {
        if (substr($content->sbname, 0, 5) == 'event') {
            $content->type = 'SBEvent';
        } elseif (substr($content->sbname, 0, 6) == 'review') {
            $content->type = 'Review';
        } elseif (substr($content->sbname, 0, 11) == 'media/audio') {
            $content->type = 'Audio';
        } elseif (substr($content->sbname, 0, 11) == 'media/video') {
            $content->type = 'Video';
        } elseif (substr($content->sbname, 0, 11) == 'media/image') {
            $content->type = 'Image';
        } elseif (substr($content->sbname, 0, 14) == 'showcase/group') {
            $content->type = 'GroupShowCase';
        } elseif (substr($content->sbname, 0, 15) == 'showcase/person') {
            $content->type = 'PersonShowCase';
        }
    }
    // replace magic strings
    $content->replace_percent_strings(PA::$url);
    $type = $content->type;
    $type = $type . 'Permalink';
    // comments
    $comments_list_tpl = new Template(CURRENT_THEME_FSPATH . "/center_comments.tpl");
    $comments_list_tpl->set('current_theme_path', PA::$theme_url);
    $comments_list_tpl->set('comments', $comments);
    $comments_list_tpl->set('author_id', $content->author_id);
    // Setting the variable for the abuse form ...
    $comments_list = $comments_list_tpl->fetch();
    //comment form
    $comment_form_tpl = new Template(CURRENT_THEME_FSPATH . "/comment_form.tpl");
    $comment_form_tpl->set('current_theme_path', PA::$theme_url);
    if (isset(PA::$login_uid)) {
        $user = new User();
        $user->load((int) PA::$login_uid);
        $login_name = $user->login_name;
        $comment_form_tpl->set('name', $login_name);
        $comment_form_tpl->set('login_name', $user->login_name);
    }
    $comment_form_tpl->set('cid', $cid);
    if ($content->parent_collection_id > 0) {
        $comment_form_tpl->set('ccid', $content->parent_collection_id);
    }
    // abuse form
    $abuse_form_tpl = new Template(CURRENT_THEME_FSPATH . "/abuse_form.tpl");
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:uihelper.php

示例2: Template

$page_content =& new Template(CURRENT_THEME_FSPATH . "/view_comments.tpl");
//tpl for header
$header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('user_name', $first_name . " " . $last_name);
if ($network_info) {
    $header->set_object('network_info', $network_info);
}
$page_content->set('header', $header);
//tpl for left side bar
$left_panel =& new Template(CURRENT_THEME_FSPATH . "/left_page.tpl");
$left_panel->set('img_path', $img_path);
$page_content->set('left_panel', $left_panel);
$comments = Comment::get_comment_for_content($cid);
$number_of_comments = count($comments);
$content->no_of_comments = $number_of_comments;
$trackback = Content::get_trackbacks_for_content($cid);
$content->trackback_url = "{$base_url}/pa_trackback.php?cid=" . $cid;
$content_user = new User();
$content_user->load((int) $content->author_id);
$time = content_date($content->changed);
$content->author_name = '<a href="user.php?uid=' . $content_user->user_id . '">' . $content_user->first_name . '</a>';
$content->create_time = content_date($content->changed);
$tags = Tag::load_tags_for_content($cid);
if ($tags) {
    $t = array();
    for ($i = 0; $i < count($tags); $i++) {
        $name = $tags[$i]['name'];
        $uid = $_SESSION['user']['id'];
        $t[] = "<a href=\"tags.php?uid={$uid}&tagname={$name}\">" . $tags[$i]['name'] . "</a>";
    }
    $tag_string = "<b>Tags : </b>" . implode(", ", $t);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:view_comments.php

示例3: html_header

require_once "BlockModules/PopularTagsModule/PopularTagsModule.php";
include_once "../api/Theme/Template.php";
require_once '../api/Content/Content.php';
require_once '../api/Comment/Comment.php';
include_once "../api/ModuleSetting/ModuleSetting.php";
require_once './includes/functions/html_generate.php';
$parameter = '<script type="text/javascript" language="javascript" src="' . $current_theme_path . '/base_javascript.js"></script></script>
<script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/prototype.js"></script>
<script type="text/javascript" language="javascript" src="' . $current_theme_path . '/javascript/scriptaculous.js"></script>';
html_header("PA-block_test", $parameter);
print '<body style="background-color: #336799;">';
default_exception();
$contents = Content::load_content_id_array();
for ($i = 0; $i < count($contents); $i++) {
    $contents[$i]['comments'] = Comment::get_comment_for_content($contents[$i]['content_id']);
    $contents[$i]['trackback'] = Content::get_trackbacks_for_content($contents[$i]['content_id']);
    $user1 = new User();
    // *** FIXME: it looks like user::load used to take a second param
    // *** that determined whether it would load deleted users or not.
    // *** this disappeared a long time ago, though, and in the meantime
    // *** a new second param has appeared, that indicates the type of
    // *** the first param.  so if anyone wants to put this back, feel
    // *** free... until then, the following code may not work as
    // *** expected:
    // Here second parameter of load_user_name is 0 it is is_active = 0
    // (it will load all users name of People aggregator whether user
    // has been deleted or exist)
    $user1->load((int) $contents[$i]['author_id']);
    //, 0);
    $contents[$i]['author_name'] = '<a href="user.php?uid=' . $user1->user_id . '">' . $user1->first_name . '</a>';
    //$contents[$i]['create_time'] = content_date($contents[$i]['changed']);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:block_test2.php

示例4: testAddDeleteContentComments

 function testAddDeleteContentComments()
 {
     //    Dal::register_query_callback("explain_query");
     echo "getting a user\n";
     $user = Test::get_test_user();
     echo "test user = {$user->first_name} {$user->last_name}\n";
     echo "adding some content\n";
     $post = new BlogPost();
     $post->author_id = $user->user_id;
     $post->parent_collection_id = -1;
     $post->title = "Test blog post (from testAddDeleteContentComments)";
     $post->body = "<p>This is the post body!</p><p>Foo <b>foo</b> foo</p>";
     $post->allow_comments = 1;
     $post->is_active = 1;
     $post->display_on = DISPLAY_ON_HOMEPAGE;
     $post->save();
     echo "... saved as content_id={$post->content_id}\n";
     echo "testing that it is retrievable\n";
     $post_retr = Content::load_content($post->content_id, $user->user_id);
     $this->assertEquals($post_retr->content_id, $post->content_id);
     $this->assertEquals($post_retr->title, $post->title);
     $this->assertEquals($post_retr->body, $post->body);
     $this->assertEquals($post_retr->author_id, $user->user_id);
     $this->assertEquals($post_retr->is_active, 1);
     echo "posting a comment\n";
     $cmt = new Comment();
     $cmt->content_id = $post->content_id;
     $cmt_comment = "This is an automatic comment - on an autogenerated post";
     $cmt->comment = $cmt_comment;
     $cmt->user_id = $user->user_id;
     $cmt->name = $cmt->email = $cmt->homepage = '';
     $cmt->ip_addr = '127.0.0.1';
     $cmt->referrer = 'http://example.com/';
     $cmt->user_agent = 'phpunit auto-test';
     $cmt->save();
     echo "... saved as comment_id={$cmt->comment_id}\n";
     echo "testing that the comment is retrievable\n";
     $cmt_retr = new Comment();
     $cmt_retr->load($cmt->comment_id);
     $this->assertEquals($cmt_retr->comment_id, $cmt->comment_id);
     $this->assertEquals($cmt_retr->content_id, $post->content_id);
     $this->assertEquals($cmt_retr->comment, $cmt_comment);
     $this->assertEquals($cmt_retr->is_active, 1);
     echo "testing that we see one comment on the post\n";
     $comments = Comment::get_comment_for_content($post->content_id);
     echo count($comments) . " comments\n";
     //var_dump($comments);
     $this->assertEquals(count($comments), 1);
     echo "testing that we have no trackbacks on the post\n";
     $trackbacks = Content::get_trackbacks_for_content($post->content_id);
     echo count($trackbacks) . " trackbacks\n";
     //var_dump($trackbacks);
     $this->assertEquals(count($trackbacks), 0);
     echo "posting ANOTHER comment\n";
     $cmt2 = new Comment();
     $cmt2->content_id = $post->content_id;
     $cmt2_comment = "This is ANOTHER automatic comment - on the same autogenerated post";
     $cmt2->comment = $cmt_comment;
     $cmt2->user_id = $user->user_id;
     $cmt2->name = $cmt2->email = $cmt2->homepage = '';
     $cmt2->ip_addr = '127.0.0.1';
     $cmt2->referrer = 'http://example.com/';
     $cmt2->user_agent = 'phpunit auto-test';
     $cmt2->save();
     echo "... saved as comment_id={$cmt2->comment_id}\n";
     echo "testing that we see two comments on the post\n";
     $comments = Comment::get_comment_for_content($post->content_id);
     $this->assertEquals(count($comments), 2);
     echo "deleting the first comment\n";
     $cmt_retr->delete();
     echo "testing that we see one comment on the post again (not seeing the deleted one)\n";
     $comments = Comment::get_comment_for_content($post->content_id);
     $this->assertEquals(count($comments), 1);
     echo "testing that the first comment (now deleted) is not retrievable\n";
     $cmt_retr_fail = new Comment();
     try {
         $cmt_retr_fail->load($cmt->comment_id);
         $this->assertTrue(FALSE);
         // shouldn't get here
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), COMMENT_NOT_EXIST);
     }
     echo "deleting the post\n";
     Content::delete_by_id($post->content_id);
     echo "testing that the post is not retrievable\n";
     try {
         $post_retr_fail = Content::load_content($post->content_id, $user->user_id);
         $this->assertTrue(FALSE);
         // shouldn't get here
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), CONTENT_NOT_FOUND);
     }
     echo "testing that the last comment is not retrievable\n";
     $cmt_retr_fail = new Comment();
     try {
         $cmt_retr_fail->load($cmt->comment_id);
         $this->assertTrue(FALSE);
         // shouldn't get here
     } catch (PAException $e) {
         $this->assertEquals($e->getCode(), COMMENT_NOT_EXIST);
//.........这里部分代码省略.........
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:ContentCommentsTest.php


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