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


PHP Comment::Create方法代码示例

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


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

示例1: comment

 public function comment()
 {
     $comment = Input::all();
     $validator = Validator::Make($comment, ['email' => 'required|email']);
     if ($validator->passes()) {
         Comment::Create($comment);
     }
 }
开发者ID:KornelMbele,项目名称:ResultSystem,代码行数:8,代码来源:CommentController.php

示例2: mail

 public function mail()
 {
     $comment = Input::all();
     $validator = Validator::Make($comment, ['email' => 'required|email']);
     if ($validator->passes()) {
         Comment::Create($comment);
         $name = $comment['name'];
         // var_dump($name);
         return Redirect::to('index')->with('success', $name . ' Your Mail is Successful Send!');
     }
     return Redirect::to('index')->with('failed', 'Invalid email,Please use genuine email for sending us your comments');
 }
开发者ID:KornelMbele,项目名称:ResultSystem,代码行数:12,代码来源:MailController.php

示例3: sizeof

             $error_message = "You already rated this idea.";
             Viewer::AddData("error_message", $error_message);
         }
     } else {
         Viewer::AddData("error_message", $error_message);
     }
     $action = "rate";
 }
 // If Commented only
 if (isset($_POST["comment_only"])) {
     $idea = Idea::GetById($id);
     if (empty($_POST["comment_text"])) {
         $error_message = I18n::L("Please fill comment text.");
     }
     if (empty($error_message)) {
         $comment = Comment::Add(Comment::Create($_POST["comment_text"], $idea, User::$current));
         $comment_lastnumber = sizeof(Comments::GetByIdea($idea));
         Notify::NotifyOfIdeaComment(User::GetById($idea->user_id), User::$current, $idea, $comment);
         header("Location:" . PREFIX . "/idea?" . $idea->idea_id . "#comment_{$comment_lastnumber}");
         exit;
     } else {
         Viewer::AddData("error_message", $error_message);
     }
     $action = "comment";
 }
 // New idea view
 if (isset($_GET["new"])) {
     if (User::Logged()) {
         Viewer::UseTemplate("new_idea.tpl");
         Viewer::AddData("title", I18n::L("Title New Idea"));
         $action = "new_idea";
开发者ID:BGCX261,项目名称:zoneideas-svn-to-git,代码行数:31,代码来源:index.php

示例4: prefetch_search

         prefetch_search('khanacad', $descr, $tags, $icrs);
         prefetch_search('wikipedia', $descr, $tags, $icrs);
         prefetch_search('itunesu', $descr, $tags, $icrs);
     }
     foreach ($procd_descr as $key => $topic) {
         $id = $ids[$key];
         $descr = $desicrs[$key];
         $tags = $tagss[$key];
         $results = array_merge(perform_search('khanacad', $descr, $tags, $icrs), perform_search('youtube', $descr, $tags, $icrs), perform_search('google', $descr, $tags, $icrs), perform_search('wikipedia', $descr, $tags, $icrs), perform_search('itunesu', $descr, $tags, $icrs));
         Error::generate('debug', $results);
         foreach ($results as $res) {
             $res['subject'] = $res['title'];
             $res['type'] = 2;
             $res['id'] = $id;
             $res['rating'] = isset($res['rating']) ? $res['rating'] : 0;
             Comment::Create($res);
         }
         //Comment::disableInitMode();
     }
     async_cache_disconnect(1);
     async_cache_disconnect(2);
     async_cache_disconnect(3);
     $memcached->delete('' . $icrs->cid);
 } else {
     foreach ($procd_descr as $key => $topic) {
         // cid, subject, timestamp
         $procd_descr[$key] = array($topic['id'], $topic['subject']);
     }
 }
 if ($lock_acquired) {
     db_end_transaction('comments', $icrs->cid);
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:index.php

示例5: htmlspecialchars

     $data['comments'] = htmlspecialchars(trim($_POST['comments']));
 } else {
     $Errors['comments'] = Language::GetText('error_comment');
 }
 // Validate output format block
 if (!empty($_POST['block'])) {
     $block = $_POST['block'] . '.tpl';
 } else {
     $block = null;
 }
 // Save comment if no errors were found
 if (empty($Errors)) {
     $data['video_id'] = $video->video_id;
     $data['status'] = 'approved';
     Plugin::Trigger('comment.ajax.before_post_comment');
     $comment_id = Comment::Create($data);
     $comment = new Comment($comment_id);
     $comment->Approve('activate');
     // Retrieve formatted new comment
     if (Settings::Get('auto_approve_comments') == 1) {
         if ($block) {
             View::InitView();
             ob_start();
             View::RepeatingBlock($block, array($comment->comment_id));
             $output = ob_get_contents();
             ob_end_clean();
         } else {
             $output = $comment;
         }
         $message = (string) Language::GetText('success_comment_posted');
         $other = array('auto_approve' => 1, 'output' => $output);
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:comment.ajax.php

示例6: check_perms

    if ($action == 'create') {
        $params['id'] = 1;
    }
}
if ($action && $ACTIONS[$action]) {
    check_perms($ACTIONS[$action]);
} else {
    // index
    check_perms(User::HasPermissions($CONTROLLER_PERMS));
}
if ($action == 'create') {
    $params['owner'] = User::GetAuthenticatedID();
    if (!$params['owner']) {
        check_perms(false);
    } else {
        if (!Comment::Create($params)) {
            Error::generate('warn', 'Could not create comment.', Error::$FLAGS['single']);
            include 'views/create.view.php';
        } else {
            Error::generate('success', 'Comment created.', Error::$FLAGS['single']);
            $args['list'] = Comment::ListAll();
            redirect('comment', 'list');
        }
    }
} else {
    if ($action == 'list') {
        $args['list'] = Comment::ListAll();
        include 'views/list.view.php';
    } else {
        if ($action == 'show') {
            $args['info'] = array(array('id', $params['id']), array('subject', Comment::GetSubject($params['id'])), array('created on', Comment::GetTimestamp($params['id'])), array('body', Comment::GetAttrib($params['id'], 'body')));
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:index.php

示例7: profiling_start

$descr = "";
$uni_id = University::GetID('University of Waterloo');
profiling_start('create courses');
foreach ($xml as $a) {
    if ($a['tag'] == "CODE") {
        $code = $a['value'];
    } else {
        if ($a['tag'] == "TITLE") {
            $title = $a['value'];
        } else {
            if ($a['tag'] == "DESCRIPTION") {
                $descr = $a['value'];
                $code = ltrim(rtrim($code));
                $title = ltrim(rtrim($title));
                $descr = ltrim(rtrim($descr));
                $cid = Comment::Create(array('subject' => $code, 'id' => 1));
                $cd = new CourseDefn(mysql_real_escape_string(htmlspecialchars($code)));
                $cd->title = db_real_escape_string(htmlspecialchars($title));
                $cd->descr = db_real_escape_string(htmlspecialchars($descr));
                $cd->cid = $cid;
                $cd->university = $uni_id;
                $cd->save();
                /*		// This code is SLOW (increases runtime by 10x):
                		$procd_descr = process_description($cd->descr);
                		foreach($procd_descr as $k => $topic) {
                			// add to sparse matrix for similarity computation
                			// prefetch relevant links with low priority
                		}
                */
            }
        }
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:mysql_init.php

示例8: header

    header("Location:login.php");
}
echo "<a href='logout.php'>Wyloguj</a><br>";
echo "<a href='main.php'>Main</a><br>";
if (isset($_GET['tweetId'])) {
    $tweetId = $_GET['tweetId'];
}
$tweetToShow = Tweet::ShowTweet($tweetId);
if ($tweetToShow !== false) {
    echo "<h2>{$tweetToShow->getText()}</h2>";
    echo "ID Tweeta: {$tweetToShow->getId()}<br>";
    echo "Autor: {$tweetToShow->getIdUsera()}<br>";
    echo "Data dodania: {$tweetToShow->getdataDodania()}<br>";
}
if ($_SERVER["REQUEST_METHOD"] === 'POST') {
    $komentarz = Comment::Create($_SESSION['userID'], $tweetId, $_POST['trescKomentarza']);
}
$tweet = Tweet::getTweetById($_GET['tweetId']);
?>
<br>
<?php 
echo "<form action = 'showTweet.php?tweetId={$tweet->getId()}' method='post'>";
?>
    <label>
        Dodaj Komentarz:
        <br>
        <input type="text" name="trescKomentarza">
    </label>
    </br>
    <input type="submit">
</form>
开发者ID:Rerek,项目名称:Tweeter,代码行数:31,代码来源:showTweet.php

示例9: date

            $comment->content = $PARAMS['content'];
            $comment->create_date = date("Ymd");
            $comment->create_hour = date("G:i:s");
            $comment->username = $_SESSION['username'];
            $comment->Create();
            echo json_encode(array("status" => "OK"));
        } else {
            //CONTESTACION
            $c = new Comment();
            $c->id = $PARAMS['referId'];
            $c->Find();
            if ($c->variables && ($c->postId = $PARAMS['id'])) {
                $comment = new Comment();
                $comment->postId = $PARAMS['id'];
                $comment->content = $PARAMS['content'];
                $comment->create_date = date("Ymd");
                $comment->create_hour = date("G:i:s");
                $comment->username = $_SESSION['username'];
                $comment->referId = $PARAMS['referId'];
                $comment->Create();
                echo json_encode(array("status" => "OK"));
            } else {
                echo json_encode(array("status" => "referNotFound"));
            }
        }
    } else {
        echo json_encode(array("status" => "postNotFound"));
    }
} else {
    echo json_encode(array("status" => "wrongData"));
}
开发者ID:grester43hck,项目名称:webProyect,代码行数:31,代码来源:postComment.php


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