本文整理汇总了PHP中Message::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getMessage方法的具体用法?PHP Message::getMessage怎么用?PHP Message::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeArrayWithFooter
/**
* mergeArrayWithFooter()
* like the default merge array but add the footer accordingly.
* It requires in the fields values: idcontact, firstname and lastname of the receiver
* Merge an Array with a currently loaded email template
* @param array $fields_values fields in format $fields['fieldname']=value;
*/
function mergeArrayWithFooter($fields_values)
{
$bodytext = $this->getTemplateBodyText();
$bodyhtml = $this->getTemplateBodyHtml();
$msg = new Message();
$unsubscribe_url = $GLOBALS['cfg_ofuz_site_http_base'] . 'unsub/' . $fields_values['idcontact'] . '/' . $_SESSION['do_User']->iduser;
$fields_values['unsubscribe_url'] = $unsubscribe_url;
$fields_values['sender_name'] = $_SESSION['do_User']->getFullName();
$fields_values['receiver_name'] = $fields_values['firstname'] . " " . $fields_values['lastname'];
if ($fields_values["flag"]) {
if ($fields_values["flag"] == "unsubscribe_autoresponder") {
//$unsubsribe_auto_responder = $this->getUnsubscribeAutoResponderLink($fields_values);
//$bodytext .= $unsubsribe_auto_responder;
//$bodyhtml .= $unsubsribe_auto_responder;
$bodyhtml .= $this->getUnsubscribeAutoResponderLinkHTML($fields_values);
$bodytext .= $this->getUnsubscribeAutoResponderLinkText($fields_values);
}
}
$bodytext .= $msg->getMessage("email footer text");
$bodyhtml .= $msg->getMessage("email footer html");
$this->setBodyText(MergeString::withArray($bodytext, $fields_values));
if (strlen($this->getTemplateBodyHtml()) > 5) {
$this->setBodyHtml(MergeString::withArray($bodyhtml, $fields_values));
}
$this->setSubject(MergeString::withArray($this->getTemplateSubject(), $fields_values));
}
示例2: testSetGet
public function testSetGet()
{
$message = new Message('success', true);
$this->assertEquals('success', $message->getMessage());
$this->assertEquals(true, $message->hasSuccess());
$message = new Message('failure', false);
$this->assertEquals('failure', $message->getMessage());
$this->assertEquals(false, $message->hasSuccess());
$message->setMessage('success');
$message->setSuccess(true);
$this->assertEquals('success', $message->getMessage());
$this->assertEquals(true, $message->hasSuccess());
$record = $message->getRecordInfo();
$this->assertEquals(array('message' => 'success', 'success' => true), $record->getData());
}
示例3: 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()));
}
示例4: send
/**
* @param Message $message
*
* @return bool
*/
public function send(Message $message)
{
$headers = array();
$post_data = array('auth' => $this->auth_token, 'originator' => $message->getFrom(), 'destination' => $message->getTo(), 'message' => $message->getMessage());
$http_response = \Requests::post(self::API_ENDPOINT, $headers, $post_data);
$gradwell_response = new Response($http_response->body);
return $http_response->success && $gradwell_response->isSuccessful();
}
示例5: buildOptions
/**
* Build Guzzle query options with json payload
*
* @param DeviceCollection $devices
* @param Message $message
* @return array
*/
private function buildOptions($devices, $message)
{
$recipients = [];
foreach ($devices as $device) {
$recipients[]['gsm'] = $device->getNumber();
}
return ['debug' => false, 'timeout' => 10, 'json' => ['authentication' => ['username' => $this->config['username'], 'password' => $this->config['password']], 'messages' => [['sender' => $this->config['sender'], 'text' => $message->getMessage(), 'recipients' => $recipients]]]];
}
示例6: testDefault
function testDefault()
{
$normal = new Message("Hi I'm a message");
$field = new Message("hey", "contents");
$bad = new Message(null);
$this->assertEquals("Hi I'm a message", $normal->getMessage());
$this->assertEquals("", $normal->getFieldName());
$this->assertEquals("hey", $field->getMessage());
$this->assertEquals("contents", $field->getFieldName());
$this->assertEquals("", $bad->getMessage());
$this->assertEquals("", $bad->getFieldName());
}
示例7: saveTo
/**
* Save mail message or messages in a folder to be sent at a later date
*
* @param string $to
* @param string $format
* @return Mail
*/
public function saveTo($to = null, $format = null)
{
$dir = null !== $to ? $to : getcwd();
if (null === $this->message->getMessage()) {
$this->message->init();
}
$messageBody = $this->message->getMessage();
$headers = $this->buildHeaders();
// Send as group message
if ($this->group) {
$email = 'To: ' . (string) $this->queue . $this->message->getEol() . 'Subject: ' . $this->subject . $this->message->getEol() . $headers . $this->message->getEol() . $this->message->getEol() . $messageBody;
$emailFileName = null !== $format ? $format : ($emailFileName = '000000001-' . time() . '-popphpmail');
// Save the email message.
file_put_contents($dir . DIRECTORY_SEPARATOR . $emailFileName, $email);
} else {
// Iterate through the queue and send the mail messages.
$i = 1;
foreach ($this->queue as $rcpt) {
$fileFormat = null;
$subject = $this->subject;
$message = $messageBody;
// Set the recipient parameter.
$to = isset($rcpt['name']) ? $rcpt['name'] . " <" . $rcpt['email'] . ">" : $rcpt['email'];
// Replace any set placeholder content within the subject or message.
foreach ($rcpt as $key => $value) {
$subject = str_replace('[{' . $key . '}]', $value, $subject);
$message = str_replace('[{' . $key . '}]', $value, $message);
if (null !== $format) {
if (null !== $fileFormat) {
$fileFormat = str_replace('[{' . $key . '}]', $value, $fileFormat);
} else {
$fileFormat = str_replace('[{' . $key . '}]', $value, $format);
}
}
}
$email = 'To: ' . $to . $this->message->getEol() . 'Subject: ' . $subject . $this->message->getEol() . $headers . $this->message->getEol() . $this->message->getEol() . $message;
if (null !== $fileFormat) {
$emailFileName = sprintf('%09d', $i) . '-' . time() . '-' . $fileFormat;
} else {
$emailFileName = sprintf('%09d', $i) . '-' . time() . '-popphpmail';
}
// Save the email message.
file_put_contents($dir . DIRECTORY_SEPARATOR . $emailFileName, $email);
$i++;
}
}
return $this;
}
示例8: send
/**
* Method which actually sends a message to Gitter
* @param Message $message
* @return GuzzleResponse
*/
public function send($message)
{
$level = 'normal';
if ($message->getColor() !== null) {
$level = $this->parseColor($message->getColor());
}
// Prefix with 'Forum activity:'
$content = '####Flarum activity ' . "\n\n";
if ($message->getAuthor() !== null) {
$content .= '@' . $message->getAuthor()->username . ' ';
}
$content .= $message->getMessage();
$content = $this->parseLinksInMessage($content, $message->getLinksToParse());
// Remove # for gutter because it will tryl to convert them into issue links
$content = str_replace('iscussion #', 'iscussion ', $content);
$data = ['form_params' => ['message' => $content, 'level' => $level]];
return $this->postApi($data);
}
示例9: send
/**
* Method which actually sends a message to Slack
* @param Message $message
* @return void
*/
public function send($message)
{
$this->prepareNotificationPayload();
$this->setMessage($message->getMessage(), $message->getShort());
$this->parseLinksInMessage($message->getLinksToParse());
if ($message->getAuthor() !== null) {
$this->setAuthor($message->getAuthor()->username, app('flarum.config')['url'] . "/u/{$message->getAuthor()->id}", $message->getAuthor()->avatar_url);
if ($message->getAuthor()->isAdmin()) {
$this->setColor('special');
}
}
if ($message->getColor() !== null) {
$this->setColor($message->getColor());
}
if ($message->getTitle() !== '') {
$this->setTitle($message->getTitle());
}
$this->sendMessage();
}
示例10: runPage
protected function runPage()
{
try {
$id = WebRequest::getInt("id");
$hash = WebRequest::get("hash");
// data validation
$customer = Customer::getById($id);
if ($customer == null) {
throw new NonexistantObjectException();
}
$customer->confirmEmail($hash);
// save
$customer->save();
Session::setLoggedInCustomer($id);
$this->mSmarty->assign("content", Message::getMessage("mail-confirmed"));
} catch (NonexistantObjectException $ex) {
global $cScriptPath;
$this->mHeaders[] = "Location: {$cScriptPath}";
}
}
示例11: testGettersAndSetters
public function testGettersAndSetters()
{
foreach ($this->messages as $message) {
$m = new Message();
$m->setTitle($message['title']);
$m->setMessage($message['message']);
$m->setUrl($message['url']);
$m->setUrlTitle($message['url_title']);
$m->setPriority($message['priority']);
$m->setSound($message['sound']);
$m->setHtml($message['html']);
$m->setDate(new \DateTime($message['date']));
$this->assertEquals($message['title'], $m->getTitle());
$this->assertEquals($message['message'], $m->getMessage());
$this->assertEquals($message['url'], $m->getUrl());
$this->assertEquals($message['url_title'], $m->getUrlTitle());
$this->assertEquals($message['priority'], $m->getPriority());
$this->assertEquals($message['sound'], $m->getSound());
$this->assertEquals($message['html'], $m->getHtml());
$this->assertEquals($message['date'], $m->getDate()->format('Y-m-d'));
}
}
示例12: _
echo _('select none');
?>
</a></span> )</span>
</div>
<div class="contentfull">
<?php
if (!is_resource($_SESSION['do_Contacts']->getResultSet())) {
$_SESSION['do_Contacts']->query("SELECT * FROM " . $_SESSION['do_Contacts']->getSqlViewName() . " ORDER BY " . $_SESSION['do_Contacts']->sql_view_order . " LIMIT " . $_SESSION['do_Contacts']->sql_qry_start . "," . $_SESSION['do_Contacts']->sql_view_limit);
}
if (strlen($_SESSION['do_Contacts']->search_keyword) > 0 && $_SESSION['do_Contacts']->getNumRows() == 0) {
echo '<br /><br />';
$e_clear_search = new Event("do_Contacts->eventClearSearch");
$data = array("click_here" => $e_clear_search->getLink(_('click here')));
$msg = new Message();
$msg->setData(array("click_here" => $e_clear_search->getLink(_('click here'))));
$msg->getMessage("no_contact_found");
$msg->displayMessage();
} else {
$_SESSION['do_Contacts']->first();
$OfuzList = new OfuzListContact($_SESSION['do_Contacts']);
$OfuzList->setMultiSelect(true);
$OfuzList->displayList();
}
?>
</div>
<div id="last_contact_loader"></div>
</form>
</td></tr></table>
<div class="spacerblock_40"></div>
<div class="layout_footer"></div>
</div>
示例13: runPage
protected function runPage()
{
if (WebRequest::wasPosted()) {
if (!WebRequest::postInt("calroom")) {
$this->showCal();
return;
}
$startdate = new DateTime(WebRequest::post("qbCheckin"));
$enddate = new DateTime(WebRequest::post("qbCheckout"));
$room = Room::getById(WebRequest::postInt("calroom"));
for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) {
if (!$room->isAvailable($date)) {
$this->error("room-not-available");
$this->showCal();
return;
}
}
// search for customer
if (!($customer = Customer::getByEmail(WebRequest::post("qbEmail")))) {
$customer = new Customer();
$suTitle = WebRequest::post("qbTitle");
$suFirstname = WebRequest::post("qbFirstname");
$suLastname = WebRequest::post("qbLastname");
$suAddress = WebRequest::post("qbAddress");
$suCity = WebRequest::post("qbCity");
$suPostcode = WebRequest::post("qbPostcode");
$suCountry = WebRequest::post("qbCountry");
$suEmail = WebRequest::post("qbEmail");
$customer->setPassword($suEmail);
// set values
$customer->setTitle($suTitle);
$customer->setFirstname($suFirstname);
$customer->setSurname($suLastname);
$address = new Address();
$address->setLine1($suAddress);
$address->setCity($suCity);
$address->setPostCode($suPostcode);
$address->setCountry($suCountry);
$address->save();
$customer->setAddress($address);
$customer->setEmail($suEmail);
// save it
$customer->save();
$customer->sendMailConfirm();
// save it again
$customer->save();
}
$booking = new Booking();
$booking->setStartDate(WebRequest::post("qbCheckin"));
$booking->setEndDate(WebRequest::post("qbCheckout"));
$booking->setAdults(WebRequest::post("qbAdults"));
$booking->setChildren(WebRequest::post("qbChildren"));
$booking->setPromocode(WebRequest::post("qbPromoCode"));
$booking->setRoom($room->getId());
$booking->setCustomer($customer->getId());
$booking->save();
$msg = Message::getMessage("booking-confirmation");
$msg = str_replace("\$1", $booking->getStartDate(), $msg);
$msg = str_replace("\$2", $booking->getEndDate(), $msg);
$msg = str_replace("\$3", $booking->getAdults(), $msg);
$msg = str_replace("\$4", $booking->getChildren(), $msg);
$msg = str_replace("\$5", $booking->getRoom()->getName(), $msg);
Mail::send($customer->getEmail(), Message::getMessage("booking-confimation-subject"), $msg);
$this->mSmarty->assign("content", $msg);
return;
}
throw new YouShouldntBeDoingThatException();
}
示例14: _
</div>
<div class="banner50 pad020 text16 fuscia_text"><?php
echo _('Google Gears Setup');
?>
</div>
<div class="contentfull">
<?php
$UserSettings = new UserSettings();
$e_set_ggear = new Event("UserSettings->eventSetSetting");
$e_set_ggear->addParam("goto", $_SERVER['PHP_SELF']);
$e_set_ggear->addParam("setting_name", "google_gears");
echo '<div class="messageshadow">';
echo '<div class="messages">';
$msg = new Message();
if ($UserSettings->getSetting("google_gears") == 'Yes') {
echo $msg->getMessage('google_gears');
echo '<br />';
$e_set_ggear->addParam("setting_value", "No");
echo $e_set_ggear->getLink(_('Turn Off'));
} else {
echo $msg->getMessage('google_gears');
echo '<br />';
$e_set_ggear->addParam("setting_value", "Yes");
echo $e_set_ggear->getLink(_('Turn On'));
}
echo '</div></div>';
echo '<br />';
?>
</div>
<div class="solidline"></div>
</td></tr></table>
示例15: _
</td><td class="layout_rcolumn">
<div class="banner60 pad020 text32"><?php
echo _('Settings');
?>
</div>
<div class="banner50 pad020 text16 fuscia_text"><?php
echo _('Web Form Builder');
?>
</div>
<div class="contentfull">
<div class="messageshadow">
<div class="messages">
<?php
$msg = new Message();
echo $msg->getMessage('web form creator instruction');
?>
</div>
</div><br />
<?php
$_SESSION['setting_mode'] = 'Yes';
if (isset($_GET['edit']) && $_GET['edit'] != '') {
$_SESSION['do_userform']->getId($_GET['edit']);
$do_userform->iduser = $_SESSION['do_User']->iduser;
$do_userform->setRegistry("webformuser");
$do_userform->newUpdateForm('do_userform');
$do_userform->form->addEventAction('do_userform->eventDeleteWebFormFields', 2100);
$do_userform->form->addEventAction('do_userform->eventAddFormFields', 2103);
$do_userform->form->goto = 'contact_web_form_url.php';
echo $do_userform->form->getFormHeader();
echo $do_userform->form->getFormEvent();