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


PHP Message::setContent方法代码示例

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


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

示例1: makeMessageByArray

 /**
  *  return Message object or null
  */
 public static function makeMessageByArray(array $data)
 {
     if (!is_array($data['message'])) {
         return null;
     }
     if (!is_array($data['message']['from'])) {
         return null;
     }
     if (!is_array($data['message']['chat'])) {
         return null;
     }
     $type = $data['message']['chat']['type'];
     $message = new Message();
     $message->setMessageId($data['message']['message_id']);
     $message->setUpdateId($data['update_id']);
     $message->setUserId($data['message']['from']['id']);
     $message->setFirstName($data['message']['from']['first_name']);
     $message->setLastName($data['message']['from']['last_name']);
     $message->setChatType($type);
     $message->setChatId($data['message']['chat']['id']);
     $message->setContent($data['message']['text']);
     $message->setCreateMessageTime($data['message']['date']);
     if ('group' === $type) {
         $message->setChatTitle($data['message']['chat']['title']);
     }
     return $message;
 }
开发者ID:glennfriend,项目名称:tg-bot,代码行数:30,代码来源:MessageHelper.php

示例2: send

 /**
  * Send a message
  *
  * @param $text
  * @param callable $callback
  */
 public function send($text, callable $callback)
 {
     $message = new Message();
     $message->setContent($text);
     $callback($message);
     $message->validate();
     $this->doSend($message);
 }
开发者ID:cscreative,项目名称:sms,代码行数:14,代码来源:Driver.php

示例3: fetchContent

	private function fetchContent( Message $message , $subtype , $msgNum , $part , array $parameters = array() ) {
		$content = base64_decode( imap_fetchbody( ImapState::$resource , $msgNum , $part ) );

		foreach ( $parameters as $parameter ) {
			if ( $parameter->attribute == 'CHARSET' ) {
				$content = mb_convert_encoding( $content , 'UTF-8' , $parameter->value );
			}
		}

		$message->setContent( $subtype , $content );
	}
开发者ID:netojoaobatista,项目名称:phpmail,代码行数:11,代码来源:ImapOpenedState.php

示例4: send

 /**
  * 批量发送消息
  * @return [type] [description]
  */
 static function send($sendId)
 {
     $pushInfoModel = new PushInfoModel();
     $db = DB::getInstance();
     if (!empty($sendId)) {
         $andSql = "and a.id={$sendId}";
     }
     $sql = "select b.device_token,b.device_type,b.token, a.params, a.id, a.content from t_push_info a, t_login b where a.to_user = b.uid and b.device_token != '' and a.is_send = 0 {$andSql} and b.token not like 'expired at%' group by device_token";
     $infos = $db->get_all($sql);
     if (count($infos > 0)) {
         foreach ($infos as $info) {
             if ($info['device_type']) {
                 $push = new XingeApp(2200102180, "661fd033916fadbf4e0866a18978782a");
                 $mess = new MessageIOS();
                 $mess->setAlert($info['content']);
                 $params = json_decode($info['params'], true);
                 if (!empty($params['content'])) {
                     $params['content'] = urldecode($params['content']);
                 }
                 $mess->setCustom($params);
                 $raw = $push->PushSingleDevice($info['device_token'], $mess, XingeApp::IOSENV_PROD);
                 $ret = json_encode($raw, true);
                 if ($ret['ret_code'] == 0) {
                     $sql = "update t_push_info set is_send = 1 where id={$info['id']}";
                     $db->query($sql);
                 }
             } else {
                 // for android
                 $push = new XingeApp(2100117084, "13391a7ec8a47d5e30525a04bd04befa");
                 $mess = new Message();
                 $mess->setTitle('合租吧');
                 $mess->setContent($info['content']);
                 $params = json_decode($info['params'], true);
                 if (!empty($params['content'])) {
                     $params['content'] = urldecode($params['content']);
                 }
                 $mess->setCustom($params);
                 $mess->setType(Message::TYPE_NOTIFICATION);
                 $mess->setStyle(new Style(0, 1, 1, 0, 0));
                 $action = new ClickAction();
                 $action->setActionType(ClickAction::TYPE_ACTIVITY);
                 $mess->setAction($action);
                 $raw = $push->PushSingleDevice($info['device_token'], $mess);
                 //$raw = XingeApp::PushTokenAndroid(2100117084, "13391a7ec8a47d5e30525a04bd04befa", "标题", "大家好!", $info['device_token']);
                 var_dump($raw);
                 $ret = json_encode($raw, true);
                 if ($ret['ret_code'] == 0) {
                     $sql = "update t_push_info set is_send = 1 where id={$info['id']}";
                     $db->query($sql);
                 }
             }
         }
     }
 }
开发者ID:skyworld,项目名称:SKY_PHP,代码行数:58,代码来源:PushInfo.class.php

示例5: testToStringFormatsTheMessage

    public function testToStringFormatsTheMessage()
    {
        $message = new Message();
        $message->addHeader('Foo: Bar');
        $message->setContent('==CONTENT==');
        $expected = <<<EOF
Foo: Bar

==CONTENT==

EOF;
        $this->assertEquals((string) $message, $expected);
    }
开发者ID:philip,项目名称:Buzz,代码行数:13,代码来源:AbstractMessageTest.php

示例6: testPut

 public function testPut()
 {
     $message = new Message();
     $message->setId(1);
     $message->setSubject('Un message');
     $message->setContent('Bonjour. Une modification');
     $message->setDatePost('2012-12-14 19:45:45');
     $message->setIdSender(1);
     $message->setIdReceiver(3);
     $messageMapper = new MessageMapper();
     $messageMapper->setId(1);
     $messageMapper->updateMessage($message);
     $this->assertEquals($message, $messageMapper->selectMessage());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:14,代码来源:MessageMapperTest.php

示例7: create

 public function create(User $user, Product $product, $content, $rate)
 {
     $message = new Message($this->db);
     $errors = array();
     $message->setUser($user);
     $message->setProduct($product);
     try {
         $message->setOrder($product);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         $message->setContent($content);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         $message->setRate($rate);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     $errors = array_filter($errors, function ($value) {
         return $value !== true;
     });
     if (count($errors) == 0) {
         $id_user = $message->getUser()->getId();
         $id_product = $message->getProduct()->getId();
         $id_order = $message->getOrder()->getId();
         $content = $this->db->quote($message->getContent());
         $rate = $this->db->quote($message->getRate());
         $query = 'INSERT INTO message (id_user, id_product, id_order, content, rate) VALUES ("' . $id_user . '","' . $id_product . '", "' . $id_order . '", ' . $content . ', ' . $rate . ')';
         $res = $this->db->exec($query);
         if ($res) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 return $this->findById($id);
             } else {
                 $errors[] = 'Internal server error';
                 return $errors;
             }
         }
     } else {
         return $errors;
     }
 }
开发者ID:berserkr1,项目名称:e-commerce,代码行数:45,代码来源:MessageManager.class.php

示例8: sendSms

 /**
  * Sends a single sms
  *
  * @return mixed
  */
 public function sendSms($message, $number)
 {
     try {
         $smsghMessage = new \Message();
         $smsghMessage->setContent($message);
         $smsghMessage->setTo($number);
         $smsghMessage->setFrom($this->getSenderName());
         $smsghMessage->setRegisteredDelivery(true);
         $messageResponse = $this->getApiMessage()->sendMessage($smsghMessage);
         if ($messageResponse instanceof \MessageResponse) {
             echo $messageResponse->getStatus();
         } elseif ($messageResponse instanceof \HttpResponse) {
             echo "\nServer Response Status : " . $messageResponse->getStatus();
         }
     } catch (\Exception $ex) {
         dd($ex);
     }
 }
开发者ID:brightantwiboasiako,项目名称:biddingapp,代码行数:23,代码来源:SMSGHSmsGateway.php

示例9: mapRow

 /**
  *  get db object by record
  *  @param  row
  *  @return TahScan object
  */
 public function mapRow($row)
 {
     $object = new Message();
     $object->setId($row['id']);
     $object->setMessageId($row['message_id']);
     $object->setUpdateId($row['update_id']);
     $object->setUserId($row['user_id']);
     $object->setFirstName($row['first_name']);
     $object->setLastName($row['last_name']);
     $object->setChatType($row['chat_type']);
     $object->setChatId($row['chat_id']);
     $object->setChatTitle($row['chat_title']);
     $object->setContent($row['content']);
     $object->setCreateMessageTime(strtotime($row['create_message_time']));
     $object->setIsUsed($row['is_used']);
     $object->setProperties(unserialize($row['properties']));
     return $object;
 }
开发者ID:glennfriend,项目名称:tg-bot,代码行数:23,代码来源:Messages.php

示例10: push_notice

 private function push_notice($type)
 {
     $id = intval($this->input['id']);
     if ($type == 'update' && !$id) {
         $this->errorOutput('id不存在');
     }
     $app_id = intval($this->input['app_push_id']);
     if (!$app_id) {
         $this->errorOutput('请选择应用');
     }
     /**************权限控制开始**************/
     //节点权限
     if ($app_id && $this->user['group_type'] > MAX_ADMIN_TYPE) {
         $nodes['nodes'][$app_id] = $app_id;
     }
     $nodes['_action'] = 'notice_manage';
     $this->verify_content_prms($nodes);
     /**************权限控制结束**************/
     $content = trim($this->input['content']);
     if (!$content) {
         $this->errorOutput('请输入通知内容');
     }
     $ios = $ios_dev = '';
     if ($this->input['ios'] == 1) {
         $ios_dev = 1;
     } else {
         if ($this->input['ios'] == 2) {
             $ios = 1;
         }
     }
     $android_sys = $this->input['android'];
     $winphone = $this->input['winphone'];
     if (!$ios && !$ios_dev && !$android_sys && !$winphone) {
         $this->errorOutput('请选择客户端设备系统');
     }
     //根据应用id查询注册应用信息
     $sql = 'SELECT * FROM ' . DB_PREFIX . "app_info WHERE id = " . $app_id;
     $appinfo = array();
     $appinfo = $this->db->query_first($sql);
     if (empty($appinfo)) {
         $this->errorOutput('注册应用信息不存在');
     }
     //扩展字段
     if ($this->input['extras']) {
         $extras = $this->input['extras'];
     }
     //通知离线时间
     $expire_time = intval($this->input['expire_time']);
     //发送时间
     $send_time = $this->input['send_time'];
     //platform_type:1信鸽,2极光,3AVOS
     $platform_type = $appinfo['platform_type'];
     //极光可以不写标题,不写标题,默认显示应用包名称
     $title = trim($this->input['title']);
     if (!$title && $platform_type == 1) {
         $this->errorOutput('请输入通知标题');
     }
     if ($platform_type == 1) {
         $accessId = $appinfo['access_id'];
         $secretKey = $appinfo['secret_key'];
         //$accessId = 2100033914;
         //$secretKey = '755776a7f60242ed472848ddf6b08197';
         if (!$accessId || !$secretKey) {
             $this->errorOutput('请传入应用信息');
         }
         include_once CUR_CONF_PATH . 'lib/XingeApp.php';
         $push = new XingeApp($accessId, $secretKey);
         $mess = new Message();
         $mess->setTitle($title);
         $mess->setContent($content);
         //0是通知,1是消息
         $mess_type = intval($this->input['mess_type']);
         if ($mess_type) {
             $mess->setType(Message::TYPE_MESSAGE);
         } else {
             $mess->setType(Message::TYPE_NOTIFICATION);
             $style = new Style(0);
             #含义:样式编号0,响铃,震动,可从通知栏清除,不影响先前通知
             $style = new Style(0, 1, 1, 1, 0);
             $mess->setStyle($style);
             #接收消息时间范围
             $acceptTime1 = new TimeInterval(0, 0, 23, 59);
             $mess->addAcceptTime($acceptTime1);
             //发送时间
             if ($send_time) {
                 $send_time .= ':00';
                 $mess->setSendTime($send_time);
             }
             //离线时间
             if ($expire_time) {
                 $mess->setExpireTime($expireTime);
             }
             $action = new ClickAction();
             $action_type = intval($this->input['action_type']);
             //点击通知操作
             $action_url = $this->input['action_url'];
             //打开的url地址
             $intent = $this->input['intent'];
             if (!$action_type) {
                 #打开activity或app本身
//.........这里部分代码省略.........
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:push_platform_update.php

示例11: _

echo _('Settings');
?>
</div>
        <div class="banner50 pad020 text16 fuscia_text"><?php 
echo _('My Information');
?>
</div>
        <div class="contentfull">
        
        <?php 
if ($_GET['message']) {
    $message = new Message();
    if ($_GET['message'] == 'reg_duplicate_email') {
        $message->getMessage("reg_duplicate_email");
    } else {
        $message->setContent($_GET['message']);
    }
    $message->displayMessage();
}
$f_user = new User();
$f_user->getId($_SESSION['do_User']->iduser);
$f_regForm = $f_user->prepareSavedForm("OfuzUserInfoUpdateForm");
$f_regForm->setFormEvent("do_User->eventUpdateUserInfo");
$f_regForm->addEventAction("do_User->eventValidationOnUpdate", 10);
$f_regForm->addParam("errPage", 'settings_info.php');
$f_regForm->setForm();
$f_regForm->execute();
?>
        </div>
        <div class="solidline"></div>
    </td></tr></table>
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:settings_info.php

示例12: testToDomDocument

 public function testToDomDocument()
 {
     $message = new Message();
     $message->setContent('<foo><bar></bar></foo>');
     $this->assertInstanceOf('DOMDocument', $message->toDomDocument());
 }
开发者ID:nschappl,项目名称:software_engineering,代码行数:6,代码来源:AbstractMessageTest.php

示例13: BasicAuth

$newMessage = "10% discount on your next purchase";
require 'Smsgh/Api.php';
//$auth = new BasicAuth("yralkzfn", "znbzlsho");
$auth = new BasicAuth("obxffxqt", "wmqimxzt");
// instance of ApiHost
$apiHost = new ApiHost($auth);
// instance of AccountApi
$accountApi = new AccountApi($apiHost);
// Get the account profile
// Let us try to send some message
$messagingApi = new MessagingApi($apiHost);
try {
    // Send a quick message
    //$messageResponse = $messagingApi->sendQuickMessage("Husby", "+2332432191768", "I love you dearly Honey. See you in the evening...");
    $mesg = new Message();
    $mesg->setContent($newMessage);
    $mesg->setTo($customer);
    $mesg->setFrom("+233543344100");
    $mesg->setRegisteredDelivery(true);
    // Let us say we want to send the message 3 days from today
    //$mesg->setTime(date('Y-m-d H:i:s', strtotime('+1 week')));
    $messageResponse = $messagingApi->sendMessage($mesg);
    if ($messageResponse instanceof MessageResponse) {
        echo '{"result": 1, "message": "' . $messageResponse->getStatus() . '"}';
        return;
        //echo $messageResponse->getStatus();
    } elseif ($messageResponse instanceof HttpResponse) {
        echo '{"result": 0, "message": "' . $messageResponse->getStatus() . '"}';
        return;
        // echo "\nServer Response Status : " . $messageResponse->getStatus();
    }
开发者ID:salmgazer,项目名称:Agrashop,代码行数:31,代码来源:sendSMS.php

示例14: PushTagAndroid

 /**
  * 使用默认设置推送消息给标签选中设备android版
  */
 public static function PushTagAndroid($accessId, $secretKey, $title, $content, $tag)
 {
     $push = new XingeApp($accessId, $secretKey);
     $mess = new Message();
     $mess->setTitle($title);
     $mess->setContent($content);
     $mess->setType(Message::TYPE_NOTIFICATION);
     $mess->setStyle(new Style(0, 1, 1, 1, 0));
     $action = new ClickAction();
     $action->setActionType(ClickAction::TYPE_ACTIVITY);
     $mess->setAction($action);
     $ret = $push->PushTags(0, array(0 => $tag), 'OR', $mess);
     return $ret;
 }
开发者ID:torry999,项目名称:lingshi,代码行数:17,代码来源:XgPush.class.php

示例15: addAutoResponder

<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
    	$("div[id^=autores]").hover(function(){$("div[id^=trashcan]",this).show("slow");},function(){$("div[id^=trashcan]",this).hide("slow");});
    });


function addAutoResponder(){
     $("#ptask_ctlbar_1").slideToggle("slow");
}
//]]>
</script>
    <?php 
if ($_SESSION['in_page_message'] != '') {
    $msg = new Message();
    $msg->setContent(htmlentities($_SESSION['in_page_message']));
    $msg->displayMessage();
}
?>
 
    
        <div class="banner60 pad020 text32"><?php 
echo _('Settings');
?>
</div>
        <div class="banner50 pad020 text16 fuscia_text">
          <?php 
echo _('Auto Responder');
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<a href = "#" onclick ="addAutoResponder();return false;">' . _('Create New') . '</a>';
?>
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:AutoResponder.php


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