本文整理汇总了PHP中Message::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::get方法的具体用法?PHP Message::get怎么用?PHP Message::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Validates a message from SNS to ensure that it was delivered by AWS
*
* @param Message $message The message to validate
*
* @throws CannotGetPublicKeyFromCertificateException If the certificate cannot be retrieved
* @throws CertificateFromUnrecognizedSourceException If the certificate's source cannot be verified
* @throws InvalidMessageSignatureException If the message's signature is invalid
*/
public function validate($message)
{
// Get the cert's URL and ensure it is from AWS
$certUrl = $message->get('SigningCertURL');
$host = parse_url($certUrl, PHP_URL_HOST);
if ('.amazonaws.com' != substr($host, -14)) {
throw new CertificateFromUnrecognizedSourceException($host . ' did not match .amazonaws.com');
}
// Get the cert itself and extract the public key
$response = wp_remote_get($certUrl);
if (is_wp_error($response)) {
throw new CannotGetPublicKeyFromCertificateException('Could not retrieve certificate from ' . $certUrl);
}
$certificate = wp_remote_retrieve_body($response);
$publicKey = openssl_get_publickey($certificate);
if (!$publicKey) {
throw new CannotGetPublicKeyFromCertificateException('Could not extract public key from ' . $certUrl);
}
// Verify the signature of the message
$stringToSign = $message->getStringToSign();
$incomingSignature = base64_decode($message->get('Signature'));
if (!openssl_verify($stringToSign, $incomingSignature, $publicKey, OPENSSL_ALGO_SHA1)) {
throw new InvalidMessageSignatureException('The message did not match the signature ' . "\n" . $stringToSign);
}
}
示例2: _subscription_confirmation
/**
* Confirms subscription
*
* @param Message $message
* @throws Exception
*/
private function _subscription_confirmation($message)
{
$topic_arn = $this->_config->get_string('cluster.messagebus.sns.topic_arn');
if ($topic_arn != $message->get('TopicArn')) {
throw new Exception('Not my Topic. My is ' . $this->_topic_arn . ' while request came from ' . $message->get('TopicArn'));
}
$this->_log('Issuing confirm_subscription');
$response = $this->_get_api()->confirm_subscription($topic_arn, $message->get('Token'));
$this->_log('Subscription confirmed: ' . ($response->isOK() ? 'OK' : 'Error'));
}
示例3: transform
/**
* Transforms an array of elastica objects into an array of
* model objects fetched from the doctrine repository
*
* @param array $elasticaObjects of elastica objects
* @throws \RuntimeException
* @return array
**/
public function transform(array $elasticaObjects)
{
$objects = array();
foreach ($elasticaObjects as $elasticaObject) {
$objects[] = \Message::get($elasticaObject->getId());
}
return $objects;
}
示例4: get_json
public function get_json()
{
$o = new stdClass();
$o->friends = Friendship::pending($this->session->user->id);
$o->notifications = Notification::from_user($this->session->user->id, 15);
$o->messages = Message::get($this->session->user->id, 10);
header("Content-type: text/html; charset=utf-8");
die('(' . json_encode($o) . ');');
}
示例5: renderGuest
public function renderGuest($roomId)
{
$messages = new Message();
$this->bag->messages = $messages->get($roomId);
$this->bag->room = $this->room->getDescription($roomId);
// glitch fix I can haz?
if ($this->guestUser instanceof User) {
$this->bag->userId = $this->guestUser->getId();
$this->bag->shortName = $this->guestUser->getShortName();
}
}
示例6: before
public function before()
{
//$this->redirect('http://ehistory.kz/manage');
parent::before();
$this->response->headers('cache-control', 'private');
// creating and attaching page metadata
$this->metadata = new Model_Metadata();
$this->metadata->title(__(Application::instance()->get('title')), false);
$this->set('_metadata', $this->metadata);
Auth::instance()->auto_login();
if (!Auth::instance()->logged_in()) {
$this->redirect('manage/auth/login');
} else {
$id = Auth::instance()->get_user()->id;
$user = ORM::factory('user', $id);
$input = $user->has('roles', ORM::factory('role', array('name' => 'admin'))) || $user->has('roles', ORM::factory('Role', array('name' => 'moderator')));
$input_redactor = $user->has('roles', ORM::factory('Role', array('name' => 'redactor')));
if (!$input && !$input_redactor) {
$this->redirect('/manage/auth/logout');
}
if (!$input && (strtolower($this->request->controller()) != 'ehistory' && strtolower($this->request->controller()) != 'language')) {
$this->redirect('manage/ehistory');
}
}
$this->user = Auth::instance()->get_user();
if (Request::$initial === Request::$current) {
$messages = Notify::instance()->get_all_once();
$this->set('_notifications', $messages);
}
$language = Session::instance()->get('_language', 'ru');
$this->language = in_array($language, array('ru', 'en', 'kz')) ? $language : 'ru';
I18n::lang($this->language);
$rr = Request::initial()->uri() . urlencode(URL::query(null, true));
$rr = trim($rr, '/');
//$this->metadata->title('Sharua.kz', false);
$countcomm = ORM::factory('Comment')->where('status', '=', '0')->count_all();
//смотрим сколько новых коментов
$this->set('_user', $this->user)->set('_language', $this->language)->set('_return_url', $rr)->set('_countcomm', $countcomm);
//вносим в переменную количество новых коментов
$knigi = ORM::factory('Book')->where('category_id', '=', '0')->find_all();
//смотрим сколько книг без категории
if ($knigi) {
if (count($knigi) > 0) {
$this->set('_uncatcount', count($knigi));
//вносим в переменную количество книг без категории
}
}
$this->referrer = Request::initial()->referrer();
if (Message::get()) {
$this->set('basic_message', Message::display('/message/basic'));
}
}
示例7: actionYourPosts
public function actionYourPosts()
{
if ($this->session->get('author_id')) {
$post = new Post();
$records = $post->GetAllPostByAuthor($this->session->get('author_id'));
if (empty($records)) {
$message = new Message('У вас пока нет постов!');
$this->html->add('content', $message->get());
$layout = new Layout($this->html->getArray());
$layout->get();
} else {
$this->view = new View($records, PATH_VIEW_POSTS, 'index_tpl.php', false);
$this->html->add('content', $this->view->render());
$layout = new Layout($this->html->getArray());
$layout->get();
}
}
}
示例8: getMessages
public function getMessages()
{
$messages = Message::get();
$id = Auth::user()->id;
$query = 'SELECT m.addressee_id, m.sender_id, m.message, m.isread, us.name as sender_name, ua.name as addressee_name from messages m
LEFT JOIN users us ON m.sender_id = us.id
LEFT JOIN users ua ON m.addressee_id = ua.id
WHERE m.id IN
(
SELECT MAX(id) FROM messages
WHERE ' . $id . ' IN(sender_id, addressee_id)
GROUP by CASE WHEN sender_id>addressee_id THEN addressee_id ELSE sender_id END,
CASE WHEN sender_id>addressee_id THEN sender_id ELSE addressee_id END
)
ORDER BY m.created_at DESC ';
$messages = DB::select($query);
$view = array('messages' => $messages);
return View::make('user.msg.messages', $view);
}
示例9: render
/**
* Renders the message(s), and by default clears them too.
*
* @param mixed string of the view to use, or a Kohana_View object
* @param boolean set to FALSE to not clear messages
* @return string message output (HTML)
*/
public static function render($view = NULL, $clear = TRUE)
{
// Nothing to render
if (($messages = Message::get()) === NULL) {
return '';
}
// Clear all messages
if ($clear) {
Message::clear();
}
if ($view === NULL) {
// Use the default view
$view = 'message/basic';
}
if (!$view instanceof Kohana_View) {
// Load the view file
$view = View::factory($view);
}
// Return the rendered view
return $view->set('messages', $messages)->render();
}
示例10: before
public function before()
{
parent::before();
// detecting language, setting it
// $this->detect_language();
// $this->set('_language', $this->language);
$this->set('device', $this->detect_device());
//var_dump($_COOKIE);
// creating and attaching page metadata
$this->metadata = new Model_Metadata();
$this->metadata->title(__(Application::instance()->get('title')), false);
$this->set('_metadata', $this->metadata);
$this->set('_token', Security::token());
// Handles return urls, cropping language out of it (will be appended by url.site at redirect time)
// $rr = Request::initial()->uri();
// $rr = trim($rr, '/');
// $rr = explode('/', $rr);
// if (in_array($rr[0], Application::instance()->get('language.list'))) {
// array_shift($rr);
// }
// $rr = implode('/', $rr);
// $this->set('_return', $rr . Url::query());
View::bind_global('_breadcumbs', $this->breadcumbs);
// detecting if user is logged in
if (method_exists(Auth::instance(), 'auto_login')) {
Auth::instance()->auto_login();
}
//
if (Auth::instance()->logged_in()) {
$id = Auth::instance()->get_user()->id;
$user = ORM::factory('user', $id);
$input = $user->has('roles', ORM::factory('role', array('name' => 'admin')));
$this->set("admin_mode", $input);
} else {
$this->set("admin_mode", false);
}
//
$this->user = Auth::instance()->get_user();
$this->set('_user', $this->user);
if (Auth::instance()->logged_in() && $this->user->profile->is_visited != 1 && strtolower($this->request->controller()) == 'profile') {
$this->redirect('profile/information', 301);
}
$sliders = ORM::factory('Slider')->where('is_active', '=', 1)->and_where('type', '=', 'slider')->order_by('order', 'asc')->find_all();
$this->set('sliders', $sliders);
$banner = ORM::factory('Slider')->where('is_active', '=', 1)->and_where('type', '=', 'banner')->find_all();
$this->set('menu_banner', $banner);
$menu = ORM::factory('Page')->where('key', '=', 'menu')->find();
//Для SEO (сортировка)
if ($this->request->controller() == 'Auth' or $this->request->controller() == 'Search' or $this->request->controller() == 'Profile') {
$this->set('sort', 1);
}
//end SEO
$page_roots = ORM::factory('Page', $menu->id)->children();
$page_main = array();
$children_pages = array();
$children_pages_last = array();
$children_pages_last_last = array();
foreach ($page_roots as $p) {
$page_main[$p->key] = array('id' => $p->id, 'name' => $p->name, 'description' => $p->description);
$children_pages[$p->key] = $p->children();
//ORM::factory('Page')->where('parent_id','=',$p->id)->find_all();//только первый уровень детей
//второй уровень детей.
foreach ($children_pages[$p->key] as $ch_p) {
if ($ch_p->id == 232 or $ch_p->id == 159) {
continue;
}
$children_pages_last[$ch_p->id] = $ch_p->children();
//третий уровень детей
foreach ($children_pages_last[$ch_p->id] as $ch_p_l) {
$children_pages_last_last[$ch_p_l->id] = $ch_p_l->children();
}
}
}
$page_halyk_kaharmany = ORM::factory('Page', 319);
$this->set('page_halyk_kaharmany', $page_halyk_kaharmany);
$this->set('_pages', $page_main)->set('_children_pages', $children_pages)->set('_children_pages_last', $children_pages_last)->set('_children_pages_last_last', $children_pages_last_last)->set('_return_url', URL::media(Request::initial()->uri()));
//для вывода сообщения о регистрации восстановления пароля и прочих действий
//само сообщение выводится в модальном окне, находится в шаблоне footer
if (Message::get()) {
$this->set('basic_message', Message::display('/message/basic'));
}
$nofollowlink = url::media(Request::initial()->uri());
$controller = strtolower(Request::initial()->controller());
$action = strtolower(Request::initial()->action());
if ($controller == 'books' and $action == 'index') {
$params = explode('books/', $_SERVER['REQUEST_URI']);
if (isset($params[1]) and isset($params[0])) {
$params = explode('?', $params[1]);
$razdel = $params[0];
} else {
$razdel = '';
}
if (isset($params[1])) {
$params = explode('=', $params[1]);
$idbook = $params[1];
} else {
$idbook = '';
}
$wherestring = 'books_' . $razdel . '_' . $idbook;
$page = ORM::factory('Page')->where('key', '=', $wherestring)->find();
//.........这里部分代码省略.........
示例11: foreach
<?php
$feedback_success = Message::get('success');
$feedback_error = Message::get('error');
$feedback_info = Message::get('info');
$feedback_warning = Message::get('warning');
// echo out positive messages
if (!empty($feedback_success)) {
foreach ($feedback_success as $feedback) {
echo '<div class="alert alert-success"><button class="close" data-dismiss="alert" type="button">×</button>' . $feedback . '</div>';
}
}
// echo out negative messages
if (!empty($feedback_error)) {
foreach ($feedback_error as $feedback) {
echo '<div class="alert alert-danger"><button class="close" data-dismiss="alert" type="button">×</button>' . $feedback . '</div>';
}
}
// echo out notice messages
if (!empty($feedback_info)) {
foreach ($feedback_info as $feedback) {
echo '<div class="alert alert-info"><button class="close" data-dismiss="alert" type="button">×</button>' . $feedback . '</div>';
}
}
// echo out notice messages
if (!empty($feedback_warning)) {
foreach ($feedback_warning as $feedback) {
echo '<div class="alert alert-warning"><button class="close" data-dismiss="alert" type="button">×</button>' . $feedback . '</div>';
}
}
Message::clear();
示例12: testGet
/**
* @covers Phossa\Di\Message\Message::get
*/
public function testGet()
{
$this->assertEquals('Service "one" method "two" error', Message::get(Message::SERVICE_METHOD_ERROR, 'one', 'two'));
}
示例13: header
/* Deletando arquivo em "../components/img" */
header("Location: index.php?msg=" . $banner->photo[Dbcommand::get('del') - 1]->delete());
/* Deletando registro do banco */
}
/* ============= Adicionar imagem =============== */
if (@$_POST) {
header("Location: index.php?msg=" . $banner->addPhoto($user->getId()));
}
?>
<!-- Banner -->
<div class="col-xs-12 col-sm-10">
<div class="jumbotron">
<a href="./"><h1>Banners</h1></a>
<br/>
<?php
echo Message::get();
?>
<form enctype="multipart/form-data" action="index.php" method="post">
<fieldset>
<div>
<h4>Nome:</h4>
<input type='text' name='name_photo' class="form-control" placeholder="Digite o Nome do Banner" pattern="^[^<>]{0,255}$" required/>
</div>
<div>
<h4>Imagem (.png, .jpeg, .jpg):</h4>
<input name="photo" id="photo" type="file" required/>
<br/>
*Tamanho recomendado: 1280x720
</div>
<br/>
示例14: header
if (!$ADK_MESSAGE->isValid()) {
$con->close();
header('Location: ../messages?e=' . $ADK_MESSAGE->err);
exit;
}
$ADK_MESSAGE->sanitize();
if ($ADK_MESSAGE->wasdraft && !$ADK_MESSAGE->isdraft) {
$ADK_MESSAGE->sendDraft($con);
} else {
if ($ADK_MESSAGE->wasdraft && $ADK_MESSAGE->isdraft) {
$ADK_MESSAGE->updateDraft($con);
} else {
$ADK_MESSAGE->save($con);
}
}
$ADK_MESSAGE->get($con);
if (!$ADK_MESSAGE->isdraft) {
$notification = '?m=s';
$ADK_USER = new User();
$ADK_USER->id = $ADK_MESSAGE->toid;
$ADK_USER->get($con);
sendPMNotifyEmail($ADK_MESSAGE, $ADK_USER);
}
//$replyFileIDs = explode(',', $_POST['replyfileids']);
//if(count($replyFileIDs) > 0 && $replyFileIDs[0] != '')
// addMessageFileJcts($con, $ADK_MESSAGE['ADK_MESSAGE_ID'], $replyFileIDs);
if (count($ADK_FILES->files) > 0) {
$ADK_FILES->save($con);
$ADK_MESSAGE->addFiles($con, $ADK_FILES->fileIDs);
}
if ($_SESSION['ADK_USERGROUP_CDE'] === 'HIK') {
示例15: array
$t->searchUsers = array();
$t->toArray = '';
$t->quote = '';
$t->alliance = isset($filtered['alliance']);
$t->officers = isset($filtered['officers']);
$t->msgId = $msgId;
try {
if (!strlen($subject)) {
$subject = _('(No Subject)');
}
if ($msgId and !($subject and $text)) {
$msg = new Message();
$msg->get($msgId);
if (me($msg->targetId) or me($msg->senderId)) {
$t->quote = $msg;
$t->quote->subject = 'RE: ' . $msg->subject;
$t->quote->text = "[quote]$msg->text[/quote]\n\n";
}
}
else if ($subject or $text) {
$t->quote->subject = $subject;
$t->quote->text = $text;
}
if (count($to)) {
foreach ($to as $toId) {
if (!$t->targets[$toId]) {
$u = new User();