本文整理汇总了PHP中Message::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::send方法的具体用法?PHP Message::send怎么用?PHP Message::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSend
public function actionSend($name = null)
{
if (defined('DISABLE_MESSAGING') && DISABLE_MESSAGING) {
throw new Lvc_Exception('Messaging disabled', 404);
}
$active_user = User::require_active_user();
$this->setLayoutVar('active_user', $active_user);
if (is_null($name)) {
throw new Lvc_Exception('Null username on send action');
}
if ($user = User::find(array('name' => $name))) {
if (!empty($this->post['submit'])) {
$subject = $this->post['subject'];
$body = $this->post['body'];
$result = Message::send($user, $subject, $body, $active_user);
if ($result['status']) {
Flash::set('success', $result['message']);
$this->redirect('/message/inbox');
die;
} else {
Flash::set('failure', $result['message']);
}
$this->setVar('subject', $subject);
$this->setVar('body', $body);
}
$this->setVar('to_user', $user);
} else {
throw new Lvc_Exception('User Not Found: ' . $name);
}
}
示例2: main
function main()
{
$controller = new Controller();
$response = null;
switch ($_POST["cmd"]) {
case "RPC":
$username = $_POST["user"];
if ($username == null) {
$username = $_SESSION['user'];
}
$pw = $_POST["pw"];
$plantname = $_POST["plant"];
$code = $_POST["code"];
$plantid = $_POST["id"];
$response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code, $plantid);
break;
case "ContentRequest":
if ($controller->IsLoggedIn() != "false") {
$response = new ContentMessage($_POST["content"], $_POST["plantid"]);
} else {
$func = "function() { this.showLoginDialog(); this.showMessage('Sie sind nicht eingeloggt bitte einloggen', 'error'); }";
$response = new RemoteProcedureCall($func);
}
break;
default:
$response = new Message('error', 'unknown Command');
break;
}
if ($response != null) {
$response->send();
} else {
echo "Error! no response was generated";
}
}
示例3: run
public function run()
{
Bundle::start('messages');
$twoweeks = date('Y-m-d', strtotime('+2 weeks'));
$week = date('Y-m-d', strtotime('+1 weeks'));
$tomorrow = date('Y-m-d', strtotime('+1 day'));
$rooms = Room::where_del_date($tomorrow)->or_where('del_date', '=', $week)->or_where('del_date', '=', $twoweeks)->get();
foreach ($rooms as $room) {
switch ($room->del_date) {
case $twoweeks:
$expire_date = "over twee weken";
break;
case $week:
$expire_date = "over een week";
break;
case $tomorrow:
$expire_date = "morgen";
break;
}
Message::send(function ($message) use($room, $expire_date) {
$message->to($room->email);
$message->from('kamers@kamergenood.nl', 'Kamergenood');
$message->subject('Verleng de kameradvertentie: "' . $room->title . '"');
$message->body('view: emails.extend');
$message->body->id = $room->id;
$message->body->title = $room->title;
$message->body->url = $room->url;
$message->body->delkey = $room->delkey;
$message->body->expire_date = $expire_date;
$message->html(true);
});
}
}
示例4: Message
function action_write()
{
if (isset($_POST['from'])) {
$to = $_POST['to'];
$from = $_POST['from'];
$text = $_POST['text'];
$author = $_POST['author'];
$msg = new Message($text, $author, $to, $from);
$msg->send();
}
}
示例5: index
public function index()
{
if (isset($this->registry->params['user_id']) && isset($this->registry->params['user_activation_verification_code'])) {
// új regisztráció ellenőrzése
$result = $this->regisztracio_model->verifyNewUser($this->registry->params['user_id'], $this->registry->params['user_activation_verification_code']);
if ($result) {
$this->view->message = Message::send('account_activation_successful');
} else {
$this->view->message = Message::send('account_activation_failed');
}
$this->view->settings = $this->regisztracio_model->get_settings();
$this->view->render('regisztracio/tpl_regisztracio', true);
} else {
Util::redirect('error');
}
}
示例6: sendPM
public function sendPM($hash)
{
if (Request::isMethod('GET')) {
$user = User::where('public_hash', '=', $hash)->firstOrFail();
return View::make('user.anonpm', ['user' => $user]);
} else {
if (!Input::get('captcha') || !$this->checkCaptcha()) {
return View::make('verif.pm_verif');
}
$input = Input::only('message');
Message::validate($input);
$user = User::where('public_hash', '=', $hash)->firstOrFail();
Message::send($user->user_fp, $input);
return Redirect::to('u/' . $hash);
}
}
示例7: run
public function run()
{
Bundle::start('messages');
$today = date('Y-m-d');
$rooms = Room::where_del_date($today)->get();
foreach ($rooms as $room) {
Message::send(function ($message) use($room) {
$message->to($room->email);
$message->from('kamers@kamergenood.nl', 'Kamergenood');
$message->subject('Kamer verlopen en verwijderd: "' . $room->title . '"');
$message->body('view: emails.deleted');
$message->body->title = $room->title;
$message->html(true);
});
$path_room_folder = getcwd() . '/public_html/img/room/' . $room->id;
File::rmdir($path_room_folder);
$room->delete();
}
}
示例8: get_approve
public function get_approve($id)
{
$room = Room::find($id);
$room->status = 'publish';
$room->save();
Message::send(function ($message) use($room) {
$message->to($room->email);
$message->from('kamers@kamergenood.nl', 'Kamergenood');
$message->subject('Kamer geplaatst: "' . $room->title . '"');
$message->body('view: emails.accept');
$message->body->id = $room->id;
$message->body->title = $room->title;
$message->body->url = $room->url;
$message->body->delkey = $room->delkey;
$message->html(true);
});
if (Message::was_sent()) {
return Redirect::to('admin')->with('msg', '<div class="alert alert-success"><strong>Kamer gepubliseerd</strong></div>');
}
}
示例9: ajax_delete_items
/**
* Rekord törlése a site_users táblából
*/
public function ajax_delete_items()
{
if (Util::is_ajax()) {
if (isset($_POST['delete_id'])) {
// ez a metódus true-val tér vissza (false esetén kivételt dob!)
$result = $this->register_subscribe_model->delete(array($_POST['delete_id']));
// visszatérés üzenetekkel
if ($result['success'] == 1) {
$message = Message::send('A felhasználó törlése sikerült.');
echo json_encode(array("status" => 'success', "message" => $message));
} else {
$message = Message::send('A felhasználó törlése nem sikerült!');
echo json_encode(array("status" => 'error', "message" => $message));
}
} else {
throw new Exception('HIBA az ajax_delete_item metódusban: Nem létezik $_POST["delete_id"]');
}
} else {
Util::redirect('error');
}
}
示例10: post_contact
public function post_contact()
{
$rules = array('name' => 'required|min:3', 'email' => 'required|email', 'subject' => 'required|min:5', 'message' => 'required|min:30', 'captchatest' => 'laracaptcha|required');
$messages = array('name_required' => 'Vul a.u.b je naam in', 'name_min' => 'Dat is wel een erg korte naam', 'email_required' => 'Vul a.u.b je emailadres in', 'email_email' => 'Dit is geen geldig emailadres', 'subject_required' => 'Geef a.u.b aan waar je bericht over gaat', 'subject_min' => 'Geef a.u.b iets uitgebreider waar je bericht over gaat', 'message_required' => 'Geen bericht geschreven', 'message_min' => 'Beschrijf je vraag of opmerking a.u.b iets uitgebreider', 'captchatest_laracaptcha' => 'De tekens komen niet overeen', 'captchatest_required' => 'De spamcheck is verplicht');
$v = Validator::make(Input::all(), $rules, $messages);
if ($v->fails()) {
return Redirect::to('contact')->with_errors($v)->with_input();
} else {
$inputs = Input::all();
Message::send(function ($message) use($inputs) {
$message->to('vragen@kamergenood.nl');
$message->from($inputs['email'], $inputs['name']);
$message->subject('Contact formulier: "' . $inputs['subject'] . '"');
$message->body('<p>Bericht via het contactformulier verstuurd:</p><p>' . nl2br($inputs['message']) . '</p>');
$message->html(true);
});
if (Message::was_sent()) {
return Redirect::to('contact')->with('msg', '<div class="alert alert-success"><strong>Bericht verzonden!</strong> Indien nodig zal er zo snel mogelijk contact met je opgenomen worden.</div>');
}
}
}
示例11: ajax_get_jobs
public function ajax_get_jobs($request_data)
{
// ebbe a tömbbe kerülnek a csoportos műveletek üzenetei
$messages = array();
$user_role = Session::get('user_role_id');
if (isset($request_data['customActionType']) && isset($request_data['customActionName'])) {
switch ($request_data['customActionName']) {
case 'group_delete':
// az id-ket tartalmazó tömböt kapja paraméterként
$result = $this->delete_job($request_data['id']);
if ($result['success'] > 0) {
$messages['success'] = $result['success'] . ' ' . Message::send('munka sikeresen törölve.');
}
if ($result['error'] > 0) {
$messages['error'] = $result['error'] . ' ' . Message::send('munka törlése nem sikerült!');
}
break;
case 'group_make_active':
$result = $this->change_status_query($request_data['id'], 1);
if ($result['success'] > 0) {
$messages['success'] = $result['success'] . Message::send(' munka státusza aktívra változott.');
}
if ($result['error'] > 0) {
$messages['error'] = $result['error'] . Message::send(' munka státusza nem változott meg!');
}
break;
case 'group_make_inactive':
$result = $this->change_status_query($request_data['id'], 0);
if ($result['success'] > 0) {
$messages['success'] = $result['success'] . Message::send(' munka státusza inaktívra változott.');
}
if ($result['error'] > 0) {
$messages['error'] = $result['error'] . Message::send(' munka státusza nem változott meg!');
}
break;
}
}
//összes sor számának lekérdezése
$total_records = $this->query->count('jobs');
$display_length = intval($request_data['length']);
$display_length = $display_length < 0 ? $total_records : $display_length;
$display_start = intval($request_data['start']);
$display_draw = intval($request_data['draw']);
$this->query->reset();
$this->query->set_table(array('jobs'));
$this->query->set_columns('SQL_CALC_FOUND_ROWS
`jobs`.`job_id`,
`jobs`.`job_title`,
`jobs`.`job_status`,
`jobs`.`job_create_timestamp`,
`jobs`.`job_update_timestamp`,
`jobs`.`job_expiry_timestamp`,
`employer`.`employer_name`,
`jobs_list`.`job_list_name`,
`users`.`user_id`,
`users`.`user_first_name`,
`users`.`user_last_name`');
$this->query->set_join('left', 'employer', 'jobs.job_employer_id', '=', 'employer.employer_id');
$this->query->set_join('left', 'jobs_list', 'jobs.job_category_id', '=', 'jobs_list.job_list_id');
$this->query->set_join('left', 'users', 'jobs.job_ref_id', '=', 'users.user_id');
$this->query->set_offset($display_start);
$this->query->set_limit($display_length);
//szűrés beállítások
if (isset($request_data['action']) && $request_data['action'] == 'filter') {
if (!empty($request_data['search_employer'])) {
$this->query->set_where('job_employer_id', 'LIKE', '%' . $request_data['search_employer'] . '%');
}
if (!empty($request_data['search_job_category'])) {
$this->query->set_where('job_category_id', 'LIKE', '%' . $request_data['search_job_category'] . '%');
}
if (!empty($request_data['search_job_id'])) {
$this->query->set_where('job_id', '=', (int) $request_data['search_job_id']);
}
if (!empty($request_data['search_referens'])) {
$this->query->set_where('job_ref_id', '=', (int) $request_data['search_referens']);
}
if (!empty($request_data['search_job_title'])) {
$this->query->set_where('job_title', 'LIKE', '%' . $request_data['search_job_title'] . '%');
}
if ($request_data['search_status'] !== '') {
$this->query->set_where('job_status', '=', (int) $request_data['search_status']);
}
}
//rendezés
if (isset($request_data['order'][0]['column']) && isset($request_data['order'][0]['dir'])) {
$num = $request_data['order'][0]['column'];
//ez az oszlop száma
$dir = $request_data['order'][0]['dir'];
// asc vagy desc
$order = $request_data['columns'][$num]['name'];
// az oszlopokat az adatbázis mezői szerint kell elnevezni (a javascript datattables columnDefs beállításában)
$this->query->set_orderby(array($order), $dir);
}
// lekérdezés
$result = $this->query->select();
// szűrés utáni visszaadott eredmények száma
$filtered_records = $this->query->found_rows();
// ebbe a tömbbe kerülnek az elküldendő adatok
$data = array();
foreach ($result as $value) {
//.........这里部分代码省略.........
示例12: fbHandle
function fbHandle($p)
{
$msg_id = Message::send($p['to'], $p['msg']);
Feedback::markHandled($p['owner'], $msg_id);
js_redirect('a/feedback/default');
}
示例13: ON
// To a thread
$threadDetails = $DB->sql_hash("SELECT f.id, f.latestReplySent, \r\n\t\t\t\t\t\tf.silenceID,\r\n\t\t\t\t\t\tsilence.userID as silenceUserID,\r\n\t\t\t\t\t\tsilence.postID as silencePostID,\r\n\t\t\t\t\t\tsilence.moderatorUserID as silenceModeratorUserID,\r\n\t\t\t\t\t\tsilence.enabled as silenceEnabled,\r\n\t\t\t\t\t\tsilence.startTime as silenceStartTime,\r\n\t\t\t\t\t\tsilence.length as silenceLength,\r\n\t\t\t\t\t\tsilence.reason as silenceReason\r\n\t\t\t\t\tFROM wD_ForumMessages f \r\n\t\t\t\t\tLEFT JOIN wD_Silences silence ON ( f.silenceID = silence.id )\r\n\t\t\t\t\tWHERE f.id=" . $new['sendtothread'] . "\r\n\t\t\t\t\t\tAND f.type='ThreadStart'");
unset($messageproblem);
if ($threadDetails['latestReplySent'] < $Misc->ThreadAliveThreshold) {
$messageproblem = l_t("The thread you are attempting to reply to is too old, and has expired.");
} elseif (Silence::isSilenced($threadDetails)) {
$silence = new Silence($threadDetails);
if ($silence->isEnabled()) {
$messageproblem = l_t("The thread you are attempting to reply to has been silenced; ") . $silence->reason;
}
unset($silence);
}
if (isset($threadDetails['id']) && !isset($messageproblem)) {
// It's being sent to an existing, non-silenced / dated thread.
try {
$new['id'] = Message::send($new['sendtothread'], $User->id, $new['message'], '', 'ThreadReply');
$_SESSION['lastPostText'] = $new['message'];
$_SESSION['lastPostTime'] = time();
$_SESSION['lastPostType'] = 'ThreadReply';
header("Location: " . $_SERVER['REQUEST_URI'] . '&reply=success');
} catch (Exception $e) {
$messageproblem = $e->getMessage();
}
} else {
$messageproblem = l_t("The thread you attempted to reply to doesn't exist.");
}
unset($threadDetails);
}
}
if (isset($messageproblem) and $new['id'] != -1) {
$_REQUEST['newmessage'] = '';
示例14: sendMessage
public function sendMessage($to, $txt)
{
$message = new Message($this->user, $this->token);
$deliveryToken = $message->send($to, $txt);
return $deliveryToken;
}
示例15: end
/**
* Send the HTTP request away.
*
* @param $callback Callable
*/
public function end($callback)
{
$message = new Message($this->url(), $this->method, $this->headers, $this->data);
list($error, $response) = $message->send($this->expectedStatus);
$callback($error, $response);
}