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


PHP sms::retrieve_settings方法代码示例

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


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

示例1: date

 $msg = $_REQUEST['message'];
 # # # # # # # # # LOG TO FILE # # # # # # # # #
 $stamp = date("Y-m-d H:i:s");
 $fp = fopen("sms.log", "a+");
 foreach ($_REQUEST as $k => $v) {
     fputs($fp, "[" . $stamp . "]" . $k . " => " . $v . "\n");
 }
 fclose($fp);
 echo "received";
 # # # # # # # # # END LOG TO FILE # # # # # # # # #
 # # # # # # # # # LOG TO DB # # # # # # # # #
 global $current_user;
 $current_user->retrieve(1);
 require_once "custom/sms/sms.php";
 $sms = new sms();
 $sms->retrieve_settings();
 require_once "modules/sugartalk_SMS/sugartalk_SMS.php";
 $sugartalk_SMS = new sugartalk_SMS();
 require_once "modules/Administration/sugartalk_smsPhone/sms_enzyme.php";
 $e = new sms_enzyme();
 $result = $e->parse_sms_macro($msg);
 if ($result['code'] != '') {
     # recreate $e and retrieve the module's id
     $e = new sms_enzyme($result['module']);
     include_once $e->mod_bean_files;
     $object = new $e->module_sing();
     $where_array = array($result['field'] => $result['code']);
     $object->retrieve_by_string_fields($where_array);
     $parent_id = $object->id;
     $parent_type = $result['module'];
     $assigned_user_id = $object->assigned_user_id;
开发者ID:omusico,项目名称:sugar_work,代码行数:31,代码来源:smsReceive.php

示例2: sendSMS

 function sendSMS($save_emails = 1, $testmode = false)
 {
     require_once 'custom/sms/sms.php';
     require_once 'modules/Administration/sugartalk_smsPhone/sms_enzyme.php';
     $sms = new sms();
     $sms->retrieve_settings();
     global $beanList, $beanFiles, $sugar_config;
     global $mod_strings;
     $mod_strings = return_module_language($sugar_config['default_language'], 'EmailMan');
     if (!isset($beanList[$this->related_type])) {
         return false;
     }
     $class = $beanList[$this->related_type];
     if (!class_exists($class)) {
         require_once $beanFiles[$class];
     }
     if (!class_exists('SMS')) {
     }
     $module = new $class();
     // tracy: the module
     $module->retrieve($this->related_id);
     // tracy: person's id
     $mod = array_search($class, $beanList);
     # tracy: use the selected phone field else use the default phone_mobile (esp for Users)
     $phone_number = "";
     if ($mod == "Users") {
         $phone_number = $module->phone_mobile;
     } elseif (!empty($mod)) {
         $e = new sms_enzyme($mod);
         $phone_field = $e->get_custom_phone_field();
         if (!empty($phone_field)) {
             $phone_number = $module->{$phone_field};
         }
     }
     $phone_number = preg_replace('/[^0-9]/', '', $phone_number);
     $this->test = $testmode;
     # tracy: invalid if there's no number
     if (empty($phone_number) or $phone_number == '') {
         $this->set_as_sent($phone_number, true, null, 'SMS', 'invalid email');
         $GLOBALS['log']->debug('Phone number was empty. Emailman id = ' . $this->id);
     }
     # tracy: check if phone number is in the suppression list
     if (isset($this->restricted_phone_numbers) && isset($this->restricted_phone_numbers[$phone_number])) {
         if ($this->restricted_phone_numbers[$phone_number] == 1) {
             $this->set_as_sent($phone_number, true, null, 'SMS', 'blocked');
             $GLOBALS['log']->debug('Phone number is in the suppression list by phone number. Emailman id = ' . $this->id);
             return true;
         }
     }
     //fetch email marketing.
     if (empty($this->current_emailmarketing) or !isset($this->current_emailmarketing)) {
         if (!class_exists('EmailMarketing')) {
         }
         $this->current_emailmarketing = new EmailMarketing();
     }
     if (empty($this->current_emailmarketing->id) or $this->current_emailmarketing->id !== $this->marketing_id) {
         $this->current_emailmarketing->retrieve($this->marketing_id);
         $this->newmessage = true;
     }
     //fetch email template associated with the marketing message.
     if (empty($this->current_emailtemplate) or $this->current_emailtemplate->id != $this->current_emailmarketing->template_id) {
         if (!class_exists('EmailTemplate')) {
         }
         $this->current_emailtemplate = new EmailTemplate();
         $this->current_emailtemplate->retrieve($this->current_emailmarketing->template_id);
     }
     $sms_message = isset($this->current_emailtemplate->body) ? $this->current_emailtemplate->body : '';
     //parse and replace bean variables in sms_message
     $template_data = $this->current_emailtemplate->parse_email_template(array('body' => $sms_message), 'Contacts', $module, $macro_nv);
     // what if user chose other accounts or user? hmm
     //replace sms_message with clean message
     $sms_message = $template_data['body'];
     # tracy: do not send sms if msg is empty
     if ($sms_message == '') {
         $this->set_as_sent($phone_number, true, null, 'SMS', 'send error');
         $GLOBALS['log']->debug('Message was empty. Emailman id = ' . $this->id);
         return false;
     }
     // fetch campaign details..
     if (empty($this->current_campaign)) {
         if (!class_exists('Campaign')) {
         }
         $this->current_campaign = new Campaign();
     }
     //refetch strings in case they have been changed by creation of email templates or other beans.
     $mod_strings = return_module_language($sugar_config['default_language'], 'EmailMan');
     # get the parent info
     $sms->parent_type = $module->object_name == 'Case' ? 'Cases' : array_search($module->object_name, $beanList);
     $sms->parent_id = $module->id;
     if (isset($sms->params) && !empty($sms->params)) {
         $sms->pname = $module->name;
         $res = $sms->send_message($phone_number, $sms_message);
         # tracy: this handles the error response from the api
         if ($sms->response_text == "SENT" || $res == "SENT") {
             $this->set_as_sent($phone_number, true, null, 'SMS', 'targeted');
             $GLOBALS['log']->debug('Message sent to {$phone_number}. Emailman id = ' . $this->id);
             return true;
         } else {
             $this->set_as_sent($phone_number, true, null, 'SMS', 'send error');
             $GLOBALS['log']->fatal('API Error: {$sms->response_text}. Emailman id = ' . $this->id);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:sugar_work,代码行数:101,代码来源:EmailMan.php


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