當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。