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


PHP xPDO::getService方法代码示例

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


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

示例1: sendEmail

 /**
  * Send an email
  *
  * @param string $subject The subject of the email
  * @param string $body The body of the email to send
  * @param string $to The email address to send to
  * @return boolean
  */
 protected function sendEmail($subject, $body, $to)
 {
     if (!$this->_loadLexicon()) {
         return false;
     }
     $this->xpdo->lexicon->load('quip:emails');
     $this->xpdo->getService('mail', 'mail.modPHPMailer');
     if (!$this->xpdo->mail) {
         return false;
     }
     $emailFrom = $this->xpdo->context->getOption('quip.emailsFrom', $this->xpdo->context->getOption('emailsender'));
     $emailReplyTo = $this->xpdo->context->getOption('quip.emailsReplyTo', $this->xpdo->context->getOption('emailsender'));
     /* allow multiple to addresses */
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     $success = false;
     foreach ($to as $emailAddress) {
         if (empty($emailAddress) || strpos($emailAddress, '@') == false) {
             continue;
         }
         $this->xpdo->mail->set(modMail::MAIL_BODY, $body);
         $this->xpdo->mail->set(modMail::MAIL_FROM, $emailFrom);
         $this->xpdo->mail->set(modMail::MAIL_FROM_NAME, $this->xpdo->context->getOption('quip.emails_from_name', 'Quip'));
         $this->xpdo->mail->set(modMail::MAIL_SENDER, $emailFrom);
         $this->xpdo->mail->set(modMail::MAIL_SUBJECT, $subject);
         $this->xpdo->mail->address('to', $emailAddress);
         $this->xpdo->mail->address('reply-to', $emailReplyTo);
         $this->xpdo->mail->setHTML(true);
         $success = $this->xpdo->mail->send();
         $this->xpdo->mail->reset();
     }
     return $success;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:42,代码来源:quipcomment.class.php

示例2: sendEmail

 /**
  * Send an email to the user
  *
  * @param string $message The body of the email
  * @param array $options An array of options
  * @return boolean True if successful
  */
 public function sendEmail($message, array $options = array())
 {
     if (!$this->xpdo instanceof modX) {
         return false;
     }
     $profile = $this->getOne('Profile');
     if (empty($profile)) {
         return false;
     }
     $this->xpdo->getService('mail', 'mail.modPHPMailer');
     if (!$this->xpdo->mail) {
         return false;
     }
     $this->xpdo->mail->set(modMail::MAIL_BODY, $message);
     $this->xpdo->mail->set(modMail::MAIL_FROM, $this->xpdo->getOption('from', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->set(modMail::MAIL_FROM_NAME, $this->xpdo->getOption('fromName', $options, $this->xpdo->getOption('site_name')));
     $this->xpdo->mail->set(modMail::MAIL_SENDER, $this->xpdo->getOption('sender', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->set(modMail::MAIL_SUBJECT, $this->xpdo->getOption('subject', $options, $this->xpdo->getOption('emailsubject')));
     $this->xpdo->mail->address('to', $profile->get('email'), $profile->get('fullname'));
     $this->xpdo->mail->address('reply-to', $this->xpdo->getOption('sender', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->setHTML($this->xpdo->getOption('html', $options, true));
     $sent = $this->xpdo->mail->send();
     $this->xpdo->mail->reset();
     return $sent;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:32,代码来源:moduser.class.php

示例3: getClient

 /**
  * Get the client responsible for communicating with the provider.
  *
  * @return modRestClient|bool A REST client instance, or FALSE.
  */
 public function getClient()
 {
     if (empty($this->xpdo->rest)) {
         $this->xpdo->getService('rest', 'rest.modRestClient');
         $loaded = $this->xpdo->rest->getConnection();
         if (!$loaded) {
             return false;
         }
     }
     return $this->xpdo->rest;
 }
开发者ID:modxcustomize,项目名称:Clickatell,代码行数:16,代码来源:modtransportprovider.class.php


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