本文整理汇总了PHP中Message::getSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getSubject方法的具体用法?PHP Message::getSubject怎么用?PHP Message::getSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::getSubject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGet
public function testSetGet()
{
$now = new \DateTime();
$testCase = ['id' => 123, 'level' => 2, 'subject' => 'TEST SUBJECT', 'message' => 'TEST MESSAGE', 'source' => 'TEST_SOURCE', 'dateCreated' => $now, 'dateCreatedString' => $now->format(\DateTime::ISO8601)];
$unit = new Message();
$unit->setId($testCase['id']);
$this->assertEquals($testCase['id'], $unit->getId());
$unit->setLevel(0);
$this->assertEquals(Message::LEVEL_DEFAULT, $unit->getLevel());
$unit->setLevel($testCase['level']);
$this->assertEquals($testCase['level'], $unit->getLevel());
$unit->setSubject($testCase['subject']);
$this->assertEquals($testCase['subject'], $unit->getSubject());
$unit->setMessage($testCase['message']);
$this->assertEquals($testCase['message'], $unit->getMessage());
$unit->setSource('');
$this->assertNull($unit->getSource());
$unit->setSource($testCase['source']);
$this->assertEquals($testCase['source'], $unit->getSource());
$unit->setDateCreated(null);
$this->assertNull($unit->getDateCreatedString());
$unit->setDateCreated($testCase['dateCreated']);
$this->assertEquals($testCase['dateCreated'], $unit->getDateCreated());
$unit->setDateCreatedString($testCase['dateCreatedString']);
$this->assertEquals($testCase['dateCreatedString'], $unit->getDateCreatedString());
$this->assertEquals($testCase['id'], $unit->toArray()['id']);
$this->assertTrue(is_array($unit->toArray()));
}
示例2: addMessage
public function addMessage($boardid, Message $message)
{
$this->addTerm("boardid", $boardid, $boardid, $message->getMessageID());
$this->addTerm("messageid", $message->getMessageID(), $boardid, $message->getMessageID());
$this->addField("author", $message->getAuthor()->getName(), $boardid, $message->getMessageID());
$this->addField("author", $message->getAuthor()->getAddress(), $boardid, $message->getMessageID());
$this->addField("author", $message->getAuthor()->getComment(), $boardid, $message->getMessageID());
$this->addField("subject", $message->getSubject(), $boardid, $message->getMessageID());
$this->addField("body", $message->getTextBody(), $boardid, $message->getMessageID());
$this->addField("body", $message->getHTMLBody(), $boardid, $message->getMessageID());
$this->addField("signature", $message->getSignature(), $boardid, $message->getMessageID());
}
示例3: htmlspecialchars
<instance>
<data xmlns="">
<from><?php
echo $_SESSION['email'];
?>
</from>
<to><?php
echo htmlspecialchars($message->getTo());
?>
</to>
<cc><?php
echo htmlspecialchars($message->getCc());
?>
</cc>
<subject><?php
echo htmlspecialchars($message->getSubject());
?>
</subject>
<body><?php
echo htmlspecialchars($message->getBody());
?>
</body>
</data>
</instance>
<submission id="compose" resource="composemessage.php"
method="urlencoded-post" />
</model>
</models>
<page-header>
<tabs ref="selected-tab">
<tab id='read'>
示例4: send
/** @override */
public function send(Message $email)
{
return $this->send_($email->getFrom(), $email->getTo(), $email->getSubject(), $email->getBody());
}
示例5: send
public function send(Message $message)
{
return mail($message->getTo(), $message->getSubject(), $message->getMessage(), $message->getAdditionalHeaders(), $message->getAdditionalParameters());
}
示例6: testGetSetSubject
public function testGetSetSubject()
{
$message = new Message();
$message->setSubject('Coucou');
$this->assertEquals('Coucou', $message->getSubject());
}
示例7: sendSimpleMessage
/**
* function sendSimpleMessage
* primary function for sending messages via array
*
* @return void
* @author Sean Grove
**/
public static function sendSimpleMessage($messageArray, $options = null)
{
// TODO: allow an email copy of the message to be sent out
sfContext::getInstance()->getLogger()->log("message:" . print_r($messageArray, true));
sfContext::getInstance()->getLogger()->log("options:" . print_r($options, true));
if (!isset($messageArray["message_type"])) {
$messageArray["message_type"] = 1;
}
sfContext::getInstance()->getLogger()->log('sending Message, owner sender');
$message = new Message();
$message->setSenderId($messageArray["from"]);
sfContext::getInstance()->getLogger()->log('set from: ' . $messageArray["from"]);
$message->setOwnerId($messageArray["owner"]);
$message->setRecipientId($messageArray["to"]);
$message->setParentId($messageArray["parent"]);
$message->setSubject($messageArray["subject"]);
$message->setBody($messageArray["text"]);
$message->setHtmlBody('me');
$message->setFolder($messageArray["folder"]);
$message->setMessageType($messageArray["message_type"]);
$message->save();
if ($message->getMessageType() == 21) {
EventUserPeer::addUser($message->getUuid(), $options["event_id"], $messageArray["from"], $options["points"], $options["comment"], $options["status"]);
}
if (isset($options["copyTo"]) && $options["copyTo"] == "sent") {
sfContext::getInstance()->getLogger()->log('sending Message, owner recipient');
$message2 = array();
$message2["from"] = $messageArray["from"];
$message2["owner"] = $messageArray["from"];
$message2["to"] = $messageArray["to"];
$message2["parent"] = $messageArray["parent"];
$message2["subject"] = $messageArray["subject"];
$message2["text"] = $messageArray["text"];
$message2["folder"] = "sent";
self::sendSimpleMessage($message2);
}
if (!isset($options["notify"]) || $options["notify"] == true) {
$sender = $message->getsfGuardUserRelatedBySenderId()->getProfile();
$recipient = $message->getsfGuardUserRelatedByRecipientId()->getProfile();
$text = '"' . $message->getSubject() . ' :: ' . $message->getBody() . '"';
$notification = 'New message from ' . $sender->getFullName() . ' on Cothink! ';
$notification .= $text;
$recipient->notify($notification);
}
sfContext::getInstance()->getLogger()->log('message sent');
}
示例8: newMessage
/**
* Compose a new message, and process new message submissions
* @parm int $reply message ID this message is in reply to [optional] only used to pre-populate subject and recipient
* @return void
*/
private function newMessage($reply = 0)
{
$this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'messages/create.tpl.php', 'footer.tpl.php');
require_once FRAMEWORK_PATH . 'models/relationships.php';
$relationships = new Relationships($this->registry);
if (isset($_POST) && count($_POST) > 0) {
$network = $relationships->getNetwork($this->registry->getObject('authenticate')->getUser()->getUserID());
$recipient = intval($_POST['recipient']);
if (in_array($recipient, $network)) {
// this additional check may not be something we require for private messages?
require_once FRAMEWORK_PATH . 'models/message.php';
$message = new Message($this->registry, 0);
$message->setSender($this->registry->getObject('authenticate')->getUser()->getUserID());
$message->setRecipient($recipient);
$message->setSubject($this->registry->getObject('db')->sanitizeData($_POST['subject']));
$message->setMessage($this->registry->getObject('db')->sanitizeData($_POST['message']));
$message->save();
// email notification to the recipient perhaps??
// confirm, and redirect
$url = $this->registry->getObject('url')->buildURL(array('messages'), '', false);
$this->registry->redirectUser($url, 'Message sent', 'The message has been sent');
} else {
$this->registry->errorPage('Invalid recipient', 'Sorry, you can only send messages to your recipients');
}
} else {
$cache = $relationships->getByUser($this->registry->getObject('authenticate')->getUser()->getUserID());
$this->registry->getObject('template')->getPage()->addTag('recipients', array('SQL', $cache));
if ($reply > 0) {
require_once FRAMEWORK_PATH . 'models/message.php';
$message = new Message($this->registry, $reply);
if ($message->getRecipient() == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
$this->registry->getObject('template')->getPage()->addAdditionalParsingData('recipients', 'ID', $message->getSender(), 'opt', "selected='selected'");
$this->registry->getObject('template')->getPage()->addTag('subject', 'Re: ' . $message->getSubject());
} else {
$this->registry->getObject('template')->getPage()->addTag('subject', '');
}
} else {
$this->registry->getObject('template')->getPage()->addTag('subject', '');
}
}
}