当前位置: 首页>>代码示例>>PHP>>正文


PHP Message::setMessage方法代码示例

本文整理汇总了PHP中Message::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::setMessage方法的具体用法?PHP Message::setMessage怎么用?PHP Message::setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message::setMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testHasMethods

 public function testHasMethods()
 {
     foreach ($this->messages as $message) {
         $m = new Message();
         $m->setMessage($message['message']);
         $m->setPriority($message['priority']);
         $this->assertFalse($m->hasTitle());
         $this->assertFalse($m->hasUrl());
         $this->assertFalse($m->hasUrlTitle());
         $this->assertFalse($m->hasSound());
         $this->assertFalse($m->hasHtml());
         $this->assertFalse($m->hasDate());
     }
     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->assertTrue($m->hasTitle());
         $this->assertTrue($m->hasUrl());
         $this->assertTrue($m->hasUrlTitle());
         $this->assertTrue($m->hasSound());
         $this->assertTrue($m->hasHtml());
         $this->assertTrue($m->hasDate());
     }
 }
开发者ID:leonardoteixeira,项目名称:pushover,代码行数:31,代码来源:MessageTest.php

示例2: 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()));
 }
开发者ID:reliv,项目名称:rcm-message,代码行数:28,代码来源:MessageTest.php

示例3: user_logout

 /**
  * Logs out a user and resets the complete session
  * @author  Clemens John <clemens-john@gmx.de>
  * @return boolean true if the logout was successfull
  */
 public function user_logout()
 {
     if (!isset($_SESSION['user_id'])) {
         $messages[] = array("Sie können sich nicht ausloggen, wenn Sie nicht eingeloggt sind", 2);
         Message::setMessage($messages);
         return false;
     } else {
         //destroy current session
         //to correctly destroy a session look at http://php.net/manual/de/function.session-destroy.php
         $stmt = DB::getInstance()->prepare("UPDATE users SET session_id = ? WHERE id = ?");
         $stmt->execute(array('', $_SESSION['user_id']));
         //delete all Remember-Mes from the database (TODO: this could be improved by storing
         //the current session id along with the remember me and then delete only the remember me
         //coresponding to the current session.
         $user_remember_me_list = new UserRememberMeList($_SESSION['user_id']);
         $user_remember_me_list->delete();
         unset($_SESSION);
         unset($_COOKIE);
         setcookie("remember_me", "", time() - 60 * 60 * 24 * 14);
         setcookie(session_name(), '', time() - 3600, '/');
         if (ini_get("session.use_cookies")) {
             $params = session_get_cookie_params();
             setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
         }
         session_destroy();
         session_start();
         $messages[] = array("Sie wurden ausgeloggt und ihre Benutzersession wurde gelöscht!", 1);
         Message::setMessage($messages);
         return true;
     }
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:36,代码来源:login.class.php

示例4: setWarningMessage

 static function setWarningMessage($msg = null)
 {
     if ($msg == null) {
         $msg = "This action can cause this.";
     }
     $class = "warning";
     Message::setMessage($class, $msg);
 }
开发者ID:janruls1,项目名称:OnlineTestSystem,代码行数:8,代码来源:message.php

示例5: convertToMessage

 function convertToMessage($msg)
 {
     $message = new Message();
     $message->setId($msg['id']);
     $message->setDate($msg['sent_date']);
     $message->setFrom($msg['msg_from']);
     $message->setMessage($msg['message']);
     $message->setSubject($msg['subject']);
     return $message;
 }
开发者ID:ArRolin,项目名称:WP-Message-Plugin,代码行数:10,代码来源:messageService.php

示例6: parse

 private function parse()
 {
     switch ($this->messageElement->getAttribute('type')) {
         case 'error':
             $this->message = new Error();
             break;
         case 'warning':
             $this->message = new Warning();
             $this->message->setLevel($this->messageElement->getAttribute('level'));
             break;
         default:
             return false;
     }
     $this->message->setRef($this->messageElement->getAttribute('ref'));
     $contextNode = $this->messageElement->getElementsByTagName('context')->item(0);
     $this->message->setContext($contextNode->nodeValue);
     $this->message->setLineNumber($contextNode->getAttribute('line'));
     $this->message->setMessage(trim($this->messageElement->getElementsByTagName('title')->item(0)->nodeValue));
 }
开发者ID:webignition,项目名称:css-validator-output-parser,代码行数:19,代码来源:Parser.php

示例7: 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());
 }
开发者ID:seytar,项目名称:psx,代码行数:15,代码来源:MessageTest.php

示例8: postTwitterMessage

 public function postTwitterMessage($statusMessage)
 {
     //Send Message to twitter
     $config_line = ConfigLine::configByName('twitter_token');
     if (ConfigLine::configByName('twitter_username') and $config_line) {
         $config = array('callbackUrl' => 'http://example.com/callback.php', 'siteUrl' => 'http://twitter.com/oauth', 'consumerKey' => ConfigLine::configByName('twitter_consumer_key'), 'consumerSecret' => ConfigLine::configByName('twitter_consumer_secret'));
         $token = unserialize($config_line);
         $client = $token->getHttpClient($config);
         $client->setUri('https://api.twitter.com/1.1/statuses/update.json');
         $client->setMethod(Zend_Http_Client::POST);
         $client->setParameterPost('status', $statusMessage);
         $response = $client->request();
         if ($response->getStatus() == 200) {
             $message[] = array("Folgendes wurde auf dem Twitteraccount von <a href=\"http://twitter.com/" . ConfigLine::configByName('twitter_username') . "\">" . ConfigLine::configByName('twitter_username') . "</a> angekündigt: <i>\"{$statusMessage}\"</i>", 1);
         } else {
             $message[] = array("Beim senden der Twitternachricht ist folgender Fehler aufgetreten: " . $response->getStatus(), 0);
         }
         Message::setMessage($message);
     }
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:20,代码来源:message.class.php

示例9: view

function view($file, $data = false)
{
    if ($data) {
        extract($data);
    }
    include $file;
}
// Load todo class
$todo = new Todo();
// Add todo
if (isset($_POST['addTodo'])) {
    if ($_POST['description'] !== '') {
        $description = $_POST['description'];
        $todo->add($description);
    } else {
        Message::setMessage('Ahh, damn. Lege todos zijn niet toegestaan...', 'error');
    }
}
// Check activation
if (isset($_POST['toggleTodo'])) {
    $id = $_POST['toggleTodo'];
    $todo->toggle($id);
}
// Delete todo
if (isset($_POST['deleteTodo'])) {
    $id = $_POST['deleteTodo'];
    $todo->delete($id);
}
// Load todos
$todoItems = $todo->getActiveItems(false);
$doneItems = $todo->getActiveItems(true);
开发者ID:didierdemaeyer,项目名称:web-backend-oplossingen,代码行数:31,代码来源:index.php

示例10: elseif

    } else {
        Permission::denyAccess(PERM_USER);
    }
} elseif ($_GET['section'] == 'insert_add') {
    if (Permission::checkPermission(PERM_USER)) {
        $dns_ressource_record = new DnsRessourceRecord(false, (int) $_POST['dns_zone_id'], (int) $_SESSION['user_id'], $_POST['host'], $_POST['type'], $_POST['pri'], (int) $_POST['destination']);
        if ($dns_ressource_record->store()) {
            $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' wurde gespeichert.', 1);
        } else {
            $message[] = array('Der Ressource Record konnte nicht gespeichert werden.', 2);
        }
        Message::setMessage($message);
        header('Location: ./dns_zone.php?dns_zone_id=' . $_POST['dns_zone_id']);
    } else {
        Permission::denyAccess(PERM_USER);
    }
} elseif ($_GET['section'] == 'delete') {
    $dns_ressource_record = new DnsRessourceRecord((int) $_GET['dns_ressource_record_id']);
    $dns_ressource_record->fetch();
    if (permission::checkIfUserIsOwnerOrPermitted(PERM_ROOT, $dns_ressource_record->getUserId())) {
        if ($dns_ressource_record->delete()) {
            $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' wurde gelöscht.', 1);
        } else {
            $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' konnte nicht gelöscht werden.', 2);
        }
        Message::setMessage($message);
        header('Location: ./dns_zone.php?dns_zone_id=' . $dns_ressource_record->getDnsZoneId());
    } else {
        Permission::denyAccess(PERM_ROOT, $dns_ressource_record->getUserId());
    }
}
开发者ID:wAmpIre,项目名称:netmon,代码行数:31,代码来源:dns_ressource_record.php

示例11: header

<?php

require_once 'autoload.php';
include 'checksession.php';
if (!checksession()) {
    header('Location: login.php');
}
if (isset($_POST['message'])) {
    $msg = new Message();
    $msg->setFrom($_SESSION['operatorid']);
    $msg->setMessage($_POST['message']);
    $msg->sendMessagesTo($_POST['opid']);
    if ($_FILES['mfile']['size'][0] > 0) {
        ///put all files held in $_FILE[mfile] in to a new array $new_arr
        $new_arr = array();
        $files = $_FILES['mfile'];
        $num = count($files["name"]);
        for ($i = 0; $i < $num; $i++) {
            $new_arr[$i] = array();
        }
        foreach ($files as $key => $row) {
            for ($i = 0; $i < $num; $i++) {
                $new_arr[$i][$key] = $files[$key][$i];
            }
        }
        ///create a new upload object and upload each file
        foreach ($new_arr as $key => $value) {
            $params['upload_path'] = 'messages/';
            $params['max_file_size'] = 1000000;
            $params['linkid'] = $msg->getLinkID();
            $params['tablename'] = 'Message_Image';
开发者ID:sknagesh,项目名称:divyaeng2,代码行数:31,代码来源:sendmessage.php

示例12: raw

 /**
  * get Message with customized content
  *
  * shorthand for getting a customized message
  *
  * @param string  $message A localized string
  * @param integer $type    A numeric representation of the type of message
  *
  * @return Message
  * @static
  */
 public static function raw($message, $type = Message::NOTICE)
 {
     $r = new Message('', $type);
     $r->setMessage($message);
     return $r;
 }
开发者ID:pjiahao,项目名称:phpmyadmin,代码行数:17,代码来源:Message.php

示例13: denyAccess

 /**
  * Deny acces to a special section. Sets a deny message and forwards the user to the login site.
  * @author  Clemens John <clemens-john@gmx.de>
  */
 public static function denyAccess($permission = false, $owner = false)
 {
     // if $permission is != false, then get the Names of the Roles that are wrapped into $permission
     if ($permission) {
         $role_string = "";
         foreach (Permission::getRolesByPermission($permission) as $key => $role) {
             if ($key) {
                 $role_string .= ", ";
             }
             $role_string .= permission::getRoleNameByRoleNumber($role);
         }
     }
     if ($owner) {
         $user = new User($owner);
         $user->fetch();
     }
     // prepare the "permission denied"-message for the user based on the combination of $permission and $owner
     if ($permission and !$owner) {
         $message[] = array("Auf diesen Bereich dürfen nur Benutzer mit den folgenden Rechten zugreifen: " . $role_string, 2);
     } elseif (!$permission and $owner) {
         $message[] = array("Auf diesen Bereich darf nur der Benutzer " . $user->getNickname() . " zugreifen.", 2);
     } elseif ($permission and $owner) {
         $message[] = array("Auf diesen Bereich dürfen nur der Benutzer " . $user->getNickname() . " oder Benutzer mit den folgenden Rechten zugreifen: " . $role_string, 2);
     } else {
         $message[] = array("Du darfst auf diesen Bereich nicht zugreifen.", 2);
     }
     // set the message
     Message::setMessage($message);
     // redirect the user to the last page he visited if it was a page inside netmon
     // if the page was not inside netmon, redirect to the default path
     if (!empty($_SESSION['last_page']) and $_SESSION['last_page'] != $_SESSION['current_page']) {
         header('Location: ' . $_SESSION['last_page']);
     } else {
         header('Location: ./');
     }
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:40,代码来源:permission.class.php

示例14: userInsertEdit

 /**
  * Insert the changes on a user into the database
  * @author  Clemens John <clemens-john@gmx.de>
  * @param $user_id
  * @param $changepassword
  * @param $permission
  * @param $oldpassword
  * @param $newpassword
  * @param $newpasswordchk
  * @param $openid
  * @param $vorname
  * @param $nachname
  * @param $strasse
  * @param $plz
  * @param $ort
  * @param $telefon
  * @param $email
  * @param $jabber
  * @param $icq
  * @param $website
  * @param $about
  * @param $notification_method
  * @return boolean if the user was edited successfull
  */
 public function userInsertEdit($user_id, $changepassword, $permission, $oldpassword, $newpassword, $newpasswordchk, $openid, $vorname, $nachname, $strasse, $plz, $ort, $telefon, $email, $jabber, $icq, $website, $about, $notification_method)
 {
     $user_data = User_old::getUserByID($user_id);
     $message = array();
     //check weatcher the given data is valid
     $phpass = new PasswordHash(8, false);
     if ($changepassword and !$phpass->CheckPassword($oldpassword, $user_data['password'])) {
         $message[] = array("Dein altes Passwort ist nicht richtig.", 2);
     } elseif ($changepassword and empty($newpassword)) {
         $message[] = array("Du musst ein neues Passwort angeben.", 2);
     } elseif ($changepassword and $newpassword != $newpasswordchk) {
         $message[] = array("Deine beiden neuen Passwörter stimmen nicht überein.", 2);
     } elseif (empty($email)) {
         $message[] = array("Du musst eine Emailadresse angeben.", 2);
     } elseif (!User_old::isUniqueEmail($email, $user_id)) {
         $message[] = array("Es existiert bereits ein Benutzer mit der ausgewhälten Emailadresse <i>{$email}</i>.", 2);
     } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         $message[] = array("Die ausgewählte Emailadresse " . $email . " ist keine gültige Emailadresse.", 2);
     } elseif (!empty($jabber) and !filter_var($jabber, FILTER_VALIDATE_EMAIL)) {
         $message[] = array("Die ausgewählte Jabberadresse " . $jabber . " ist keine gültige Jabberadresse.", 2);
     } elseif (!empty($openid) and !User_old::isUniqueOpenID($openid, $user_id)) {
         $message[] = array("Die ausgewählte OpenID <i>" . $openid . "</i> ist bereits mit einem Benutzer verknüpft.", 2);
     }
     //if the user data is not valid, return false
     if (count($message) > 0) {
         Message::setMessage($message);
         return false;
     }
     //if user wants to set a new password, encrypt new password
     if ($changepassword) {
         $newpassword = $phpass->HashPassword($newpassword);
         if (strlen($newpassword) < 20) {
             $message[] = array("Beim Hashen des neuen Passworts trat ein Fehler auf.", 2);
             Message::setMessage($message);
             return false;
         }
     } else {
         $newpassword = $user_data['password'];
     }
     if (!$permission) {
         $newpermission = $user_data['permission'];
     } else {
         $newpermission = 0;
         foreach ($permission as $dual) {
             $newpermission += $dual;
         }
     }
     //if all checks are okay, update the data into the database
     $stmt = DB::getInstance()->prepare("UPDATE users SET \n\t\t\t\t\t\t\t   permission = ?, password = ?, openid = ?, vorname = ?, nachname = ?,\n\t\t\t\t\t\t\t   strasse = ?, plz = ?, ort = ?, telefon = ?, email = ?, jabber = ?,\n\t\t\t\t\t\t\t   icq = ?, website = ?, about = ?, notification_method = ?\n\t\t\t\t\t\t    WHERE id = ?");
     $stmt->execute(array($newpermission, $newpassword, $openid, $vorname, $nachname, $strasse, $plz, $ort, $telefon, $email, $jabber, $icq, $website, $about, $notification_method, $user_id));
     $message[] = array("Die Daten von {$user_data['nickname']} wurden geändert", 1);
     message::setMessage($message);
     return true;
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:78,代码来源:user_old.class.php

示例15: updateMessageIfNewest

 /**
  */
 public function updateMessageIfNewest(Project $project, $bundle, $key, $language, $catalog, $lastModification, $message)
 {
     if (!$bundle || !$language || !$key || !$lastModification || !$message) {
         return $this->exception('Validation exceptions, missing parameters');
     }
     /** @var Key $keyRecord */
     $keyRecord = $this->getKeyRepository()->findOneBy(array('project' => $project, 'bundle' => $bundle, 'key' => $key, 'catalog' => $catalog));
     if (!$keyRecord) {
         $keyRecord = new Key();
         $keyRecord->setProject($project);
         $keyRecord->setKey($key);
         $keyRecord->setBundle($bundle);
         $keyRecord->setCatalog($catalog);
         $this->em->persist($keyRecord);
         $this->em->flush();
     }
     /** @var Message $messageRecord */
     $messageRecord = $this->getMessageRepository()->findOneBy(array('key' => $keyRecord, 'language' => $language));
     if (!$messageRecord) {
         $messageRecord = new Message();
         $messageRecord->setKey($keyRecord);
         $messageRecord->setLanguage($language);
     } else {
         if ($messageRecord->getUpdatedAt() >= $lastModification) {
             return $this->resultOk(array('updated' => false, 'message' => $messageRecord->getMessage(), 'updatedAt' => $messageRecord->getUpdatedAt()->format('c')));
         }
     }
     $messageRecord->setMessage($message);
     $messageRecord->setUpdatedAt($lastModification);
     $this->em->persist($messageRecord);
     $this->em->flush($messageRecord);
     return $this->resultOk(array('updated' => true, 'message' => $messageRecord->getMessage(), 'updatedAt' => $messageRecord->getUpdatedAt()->format('c')));
 }
开发者ID:jlaso,项目名称:tradukoj,代码行数:35,代码来源:ServerMongoCommand.php


注:本文中的Message::setMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。