本文整理汇总了PHP中Tweet::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Tweet::create方法的具体用法?PHP Tweet::create怎么用?PHP Tweet::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tweet
的用法示例。
在下文中一共展示了Tweet::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hideTweet
public function hideTweet($tweet_id)
{
if (Request::ajax()) {
$tweet = Tweet::create(['tweet_id' => $tweet_id]);
return Response::json(true);
}
}
示例2: addFavoris
public static function addFavoris($req_twitter, $name_id)
{
foreach ($req_twitter as $key => $value) {
Tweet::create(array('name_id' => $name_id->id, 'id_str' => $value->id, 'screen_name' => $value->user->screen_name, 'name' => $value->user->name, 'profile_image_url' => $value->user->profile_image_url, 'text' => $value->text, 'date_tweet' => $value->created_at));
$max_id = $value->id;
}
return $max_id;
}
示例3: Tweet
<?php
session_start();
require_once '../resources/require.php';
// Dodaje nowy wpis do bazy, uzupełnia komunikat o dodaniu bądź błędach.
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (trim($_POST['text']) != '') {
$tweet = new Tweet($mysqli);
$tweet->setUserId($_SESSION['user_id']);
$tweet->setText($_POST['text']);
if (!$tweet->create()) {
$info = 'Błąd przy dodawaniu wpisu';
} else {
$info = 'Dodano nowy wpis';
}
} else {
$info = 'Uzupełnij treść wpisu!';
}
}
?>
<!DOCTYPE html>
<html lang="pl-PL">
<title>Twitter | Strona główna</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
示例4: htmlspecialchars
<?php
include_once "../configRoot.php";
require_once ROOT_NAME . "/classes/Database.php";
require_once ROOT_NAME . "/classes/Tweet.php";
require_once ROOT_NAME . "/includes/checkProfile.php";
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["tweet"])) {
$text = $_POST["tweet"];
$text = htmlspecialchars($text);
$db = Database::getInstance();
$conn = $db->getConnection();
$tweet = new Tweet($conn);
$tweet->setUserId($id);
$tweet->setText($text);
$tweet->create();
header("location: ../index.php");
} else {
header("location: ../index.php");
}
示例5: foreach
<input type="hidden" name="tweet_id" value="' . $tweet['id'] . '">
<input type="submit" value="Dodaj komentarz">
</form>
';
$comment_counter = 0;
//licznik komentarzy zawsze zaczyna od zera
foreach (Comment::loadAllComments($tweet['id']) as $comment) {
$comment_counter++;
//zliczanie ilosci komentarzy
}
echo '<div class="comment">Ilość komentarzy: ' . $comment_counter . '<a href="show_post.php?tweetId=' . $tweet['id'] . '&userName=' . $userToShow->getName() . '"> POKAŻ WIĘCEJ</a></div>';
echo '<div style=" margin: 60px 0px"></div>';
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['forms'] == 'sending_message') {
if ($_POST['message'] != null) {
Message::sendMessage($currentlyLoggedUser->getId(), $_POST['receiver'], $_POST['message'], date('Y-m-d G:i:s'));
header('Location: showUser.php?userId=' . $_POST['receiver']);
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['forms'] == 'adding_comment') {
Comment::addComment($_POST['tweet_id'], $currentlyLoggedUser->getId(), $_POST['comment'], date('Y-m-d G:i:s'));
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['forms'] == 'adding_tweet') {
if ($_POST['tweet_text'] != null) {
Tweet::create($currentlyLoggedUser->getId(), $_POST['tweet_text'], date('Y-m-d G:i:s'));
header('Location: showUser.php');
} else {
echo 'Twoj tweet jest pusty, jeżeli chcesz go wysłać to wprowadź do niego tekst';
}
}
}