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


PHP ServiceLocator::getService方法代码示例

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


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

示例1: getServiceLocator

 /**
  * Gets the service locator (experimental).
  * @return IServiceLocator
  */
 public final function getServiceLocator()
 {
     if ($this->serviceLocator === NULL) {
         $this->serviceLocator = new ServiceLocator(Environment::getServiceLocator());
         foreach ($this->defaultServices as $name => $service) {
             if ($this->serviceLocator->getService($name, FALSE) === NULL) {
                 $this->serviceLocator->addService($service, $name);
             }
         }
     }
     return $this->serviceLocator;
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:16,代码来源:Application.php

示例2: ScriptS

 function ScriptS()
 {
     //Cria o objeto;
     $this->SieveS = new SieveS();
     //$this->scriptfile = $GLOBALS['HTTP_SESSION_VARS']['phpgw_info']['expressomail']['user']['account_lid'];
     $this->scriptfile = $_SESSION['phpgw_info']['expressomail']['user']['account_lid'];
     $this->username = $this->scriptfile;
     $this->reply = "";
     $this->rules = "";
     $this->errstr = "";
     $this->size = "";
     $this->continuebit = 1;
     $this->sizebit = 2;
     $this->anyofbit = 4;
     $this->keepbit = 4;
     $this->regexbit = 128;
     $this->EmailVoip = trim($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_email_redirect']);
     $this->EmailExpresso = trim($_SESSION['phpgw_info']['expressomail']['user']['email']);
     include_once dirname(__FILE__) . '/../../header.inc.php';
     require_once dirname(__FILE__) . '/../../services/class.servicelocator.php';
     $alternativeMailService = ServiceLocator::getService('ldap');
     $this->AlternateEmailExpresso = $alternativeMailService->getMailAlternateByUidNumber($_SESSION['phpgw_info']['expressomail']['user']['account_id']);
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:23,代码来源:class.ScriptS.inc.php

示例3: initializeTemplate

 /**
  * initialize template engine
  */
 protected function initializeTemplate()
 {
     /**
      * @triggerEvent before_init_template this event is triggered before the template engine is init
      */
     Event::triggerEvent('before_init_template');
     $templateEngine = ServiceLocator::getService('Phile_Template');
     /**
      * @triggerEvent before_render_template this event is triggered before the template is rendered
      *
      * @param \Phile\ServiceLocator\TemplateInterface the template engine
      */
     Event::triggerEvent('before_render_template', array('templateEngine' => &$templateEngine));
     $templateEngine->setCurrentPage($this->page);
     $output = $templateEngine->render();
     /**
      * @triggerEvent after_render_template this event is triggered after the template is rendered
      *
      * @param \Phile\ServiceLocator\TemplateInterface the    template engine
      * @param                                         string the generated ouput
      */
     Event::triggerEvent('after_render_template', array('templateEngine' => &$templateEngine, 'output' => &$output));
     $this->response->setBody($output);
 }
开发者ID:patrova,项目名称:Phile,代码行数:27,代码来源:Core.php

示例4: array

<?php

/***************************************************************************
		* Expresso Livre                                                           *
		* http://www.expressolivre.org                                             *
		* --------------------------------------------                             *
		*  This program is free software; you can redistribute it and/or modify it *
		*  under the terms of the GNU General Public License as published by the   *
		*  Free Software Foundation; either version 2 of the License, or (at your  *
		*  option) any later version.                                              *
		\**************************************************************************/
$GLOBALS['phpgw_info']['flags'] = array('noheader' => false, 'nonavbar' => false, 'currentapp' => 'expressoMail', 'enable_nextmatchs_class' => true);
require_once __DIR__ . '/../header.inc.php';
require_once __DIR__ . '/../services/class.servicelocator.php';
$template = CreateObject('phpgwapi.Template', PHPGW_APP_TPL);
$alternativeMailService = ServiceLocator::getService('ldap');
$AlternateEmailExpresso = array();
$AlternateEmailExpresso = isset($_SESSION['phpgw_info']['expressomail']) ? $alternativeMailService->getMailAlternateByUidNumber($_SESSION['phpgw_info']['expressomail']['user']['account_id']) : "";
if (is_array($AlternateEmailExpresso)) {
    $template->set_var("user_email_alternative", implode(",", $AlternateEmailExpresso));
}
if (execmethod('emailadmin.ui.countProfiles') == 0) {
    execmethod('emailadmin.ui.addDefaultProfile');
}
$update_version = $GLOBALS['phpgw_info']['apps']['expressoMail']['version'];
$_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
//////////////////////////////////////////// Enable/Disable VoIP Service -> Voip Server Config /////////////////////////
$voip_enabled = false;
$voip_groups = array();
$emailVoip = false;
if (isset($GLOBALS['phpgw_info']['server']['voip_groups'])) {
开发者ID:cjvaz,项目名称:expressomail,代码行数:31,代码来源:index.php

示例5: get_available_users2

 function get_available_users2($params)
 {
     $ldapService = ServiceLocator::getService('ldap');
     $ldapService->connect($_SESSION['phpgw_info']['expressomail']['server']['ldap_host'], $_SESSION['phpgw_info']['expressomail']['server']['ldap_root_dn'], $_SESSION['phpgw_info']['expressomail']['server']['ldap_root_pw']);
     $entries = $ldapService->accountSearch($params['sentence'], array('cn', 'uid'), $params['context'], 'u', 'cn');
     $options = array();
     foreach ($entries as $value) {
         $options[] = '"' . $value['uid'] . '"' . ':' . '"' . $value['cn'] . '"';
     }
     return "{" . implode(',', $options) . "}";
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:11,代码来源:class.ldap_functions.inc.php

示例6: report_mail_error

 /**
  * Método que envia um email reportando um erro no email do usuário
  * @license http://www.gnu.org/copyleft/gpl.html GPL
  * @author Prognus Software Livre (http://www.prognus.com.br)
  */
 function report_mail_error($params)
 {
     $params = $params['params'];
     $array_params = explode(";;", $params);
     $id_msg = $array_params[0];
     $msg_user = $array_params[1];
     $msg_folder = $array_params[2];
     if ($msg_user == '') {
         $msg_user = "Sem mensagem!";
     }
     $toname = $_SESSION['phpgw_info']['expressomail']['user']['fullname'];
     $exporteml = new ExportEml();
     $mail_content = $exporteml->export_msg_data($id_msg, $msg_folder);
     $this->open_mbox($msg_folder);
     $title = "Erro de email reportado";
     $body = "<body>O usu&aacute;rio <strong>{$toname}</strong> reportou um erro na tentativa de acesso ao conte&uacute;do do email.<br><br>Segue em anexo o fonte da mensagem" . " reportada.<br><br><hr><strong><u>Mensagem do usu&aacute;rio:</strong></u><br><br><br>" . "{$msg_user}</body><br><br><hr>";
     require_once dirname(__FILE__) . '/../../services/class.servicelocator.php';
     $mailService = ServiceLocator::getService('mail');
     $mailService->addStringAttachment($mail_content, 'report.eml', 'application/text');
     $mailService->sendMail($_SESSION['phpgw_info']['expressomail']['server']['sugestoes_email_to'], $GLOBALS['phpgw_info']['user']['email'], $title, $body);
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:26,代码来源:class.imap_functions.inc.php

示例7: create

 public function create($URI, &$data)
 {
     switch ($URI['concept']) {
         case 'labeled':
             if (isset($data['folderName']) && isset($data['messageNumber']) && isset($data['labelId'])) {
                 $this->mbox = $this->open_mbox($data['folderName']);
                 imap_setflag_full($this->mbox, $data['messageNumber'], '$Label' . $data['labelId'], ST_UID);
                 return array('id' => $data['folderName'] . '/' . $data['messageNumber'] . '#' . $data['labelId']);
             }
             return array();
         case 'followupflagged':
             //deve ser gravado primeiro no imap, obtido o message-id e, depois gravado no banco
             if (isset($data['folderName']) && isset($data['messageNumber'])) {
                 $this->mbox = $this->open_mbox($data['folderName']);
                 $s = imap_setflag_full($this->mbox, $data['messageNumber'], '$Followupflagged', ST_UID);
                 $headers = imap_fetch_overview($this->mbox, $data['messageNumber'], FT_UID);
                 $data['messageId'] = $headers[0]->message_id;
                 /*
                  * TODO
                  * Verificar erro ao tentar setar uma flag com o limite de flags atingido
                  * onde o status retornado pelo imap_setflag_full é true mesmo não sendo possível
                  * a inserção da flag.
                  */
                 return $s && imap_last_error() != 'Too many user flags in mailbox' ? $data : array();
             } else {
                 if (isset($data['messageId'])) {
                     /**
                      * Busca pela mensagem com o messageId dado. Se uma pasta foi passada, busca nela,
                      * senão busca em todas.
                      */
                     $folders = array();
                     if (isset($data['folderName'])) {
                         $folders = array($data['folderName']);
                     } else {
                         $folder_list = $this->get_folders_list();
                         foreach ($folder_list as $folder) {
                             if (isset($folder['folder_id'])) {
                                 $folders[] = $folder['folder_id'];
                             }
                         }
                     }
                     foreach ($folders as $folder) {
                         $this->mbox = $this->open_mbox($folder);
                         if ($messages = imap_search($this->mbox, 'ALL TEXT "Message-Id: ' . $data['messageId'] . '"', SE_UID)) {
                             $s = imap_setflag_full($this->mbox, $messages[0], '$Followupflagged', ST_UID);
                             /**
                              * Stop searching in all folders
                              */
                             return $data;
                         }
                     }
                 }
             }
             return array();
         case 'message':
             require_once ROOTPATH . '/library/uuid/class.uuid.php';
             $GLOBALS['phpgw_info']['flags'] = array('noheader' => true, 'nonavbar' => true, 'currentapp' => 'expressoMail', 'enable_nextmatchs_class' => True);
             $return = array();
             require_once dirname(__FILE__) . '/../../services/class.servicelocator.php';
             $mailService = ServiceLocator::getService('mail');
             $msg_uid = $data['msg_id'];
             $body = $data['body'];
             $body = str_replace("&lt;", "&yzwkx;", $body);
             //Alterar as Entities padrão das tags < > para compatibilizar com o Expresso
             $body = str_replace("&gt;", "&xzwky;", $body);
             $body = str_replace("%nbsp;", "&nbsp;", $body);
             $body = html_entity_decode($body, ENT_QUOTES, 'ISO-8859-1');
             $body = str_replace("&yzwkx;", "&lt;", $body);
             $body = str_replace("&xzwky;", "&gt;", $body);
             $folder = mb_convert_encoding($data['folder'], "UTF7-IMAP", "ISO-8859-1, UTF-8");
             $folder = @preg_replace('/INBOX[\\/.]/i', "INBOX" . $this->imap_delimiter, $folder);
             /**
              * Gera e preenche o field Message-Id do header
              */
             $mailService->addHeaderField('Message-Id', UUID::generate(UUID::UUID_RANDOM, UUID::FMT_STRING) . '@Draft');
             $mailService->addHeaderField('Reply-To', mb_convert_encoding($data['input_reply_to'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
             $mailService->addHeaderField('Date', date("d-M-Y H:i:s"));
             $mailService->addTo(mb_convert_encoding($data['input_to'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
             $mailService->addCc(mb_convert_encoding($data['input_cc'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
             $mailService->addBcc(mb_convert_encoding($data['input_cco'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
             $mailService->setSubject(mb_convert_encoding($data['input_subject'], 'ISO-8859-1', 'UTF-8,ISO-8859-1'));
             if (isset($data['input_important_message'])) {
                 $mailService->addHeaderField('Importance', 'High');
             }
             if (isset($data['input_return_receipt'])) {
                 $mailService->addHeaderField('Disposition-Notification-To', Config::me('mail'));
             }
             $this->rfc2397ToEmbeddedAttachment($mailService, $body);
             $isHTML = isset($data['type']) && $data['type'] == 'html' ? true : false;
             if (!$body) {
                 $body = ' ';
             }
             $mbox_stream = $this->open_mbox($folder);
             $attachment = json_decode($data['attachments'], TRUE);
             if (!empty($attachment)) {
                 foreach ($attachment as &$value) {
                     if ((int) $value > 0) {
                         $att = Controller::read(array('id' => $value, 'concept' => 'mailAttachment'));
                         if ($att['disposition'] == 'embedded' && $isHTML) {
                             $body = str_replace('"../prototype/getArchive.php?mailAttachment=' . $att['id'] . '"', '"' . mb_convert_encoding($att['name'], 'ISO-8859-1', 'UTF-8,ISO-8859-1') . '"', $body);
//.........这里部分代码省略.........
开发者ID:cjvaz,项目名称:expressomail,代码行数:101,代码来源:ImapServiceAdapter.php


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