當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ServiceManager::getServiceLocator方法代碼示例

本文整理匯總了PHP中Zend\ServiceManager\ServiceManager::getServiceLocator方法的典型用法代碼示例。如果您正苦於以下問題:PHP ServiceManager::getServiceLocator方法的具體用法?PHP ServiceManager::getServiceLocator怎麽用?PHP ServiceManager::getServiceLocator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\ServiceManager\ServiceManager的用法示例。


在下文中一共展示了ServiceManager::getServiceLocator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUserComments

 /**
  * Factory for UserComments tab plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserComments
  */
 public static function getUserComments(ServiceManager $sm)
 {
     $capabilities = $sm->getServiceLocator()->get('VuFind\\AccountCapabilities');
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $useRecaptcha = isset($config->Captcha) && isset($config->Captcha->forms) && (trim($config->Captcha->forms) === '*' || strpos($config->Captcha->forms, 'userComments'));
     return new UserComments('enabled' === $capabilities->getCommentSetting(), $useRecaptcha);
 }
開發者ID:bbeckman,項目名稱:NDL-VuFind2,代碼行數:14,代碼來源:Factory.php

示例2: getReviews

 /**
  * Create Reviews loader
  *
  * @param ServiceManager $sm Service manager
  *
  * @return mixed
  */
 public static function getReviews(ServiceManager $sm)
 {
     $loader = $sm->getServiceLocator()->get('VuFind\\ContentReviewsPluginManager');
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $providers = isset($config->Content->reviews) ? $config->Content->reviews : '';
     return new Loader($loader, $providers);
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:14,代碼來源:Factory.php

示例3: getSolr

 /**
  * Factory for Solr driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolr(ServiceManager $sm)
 {
     $cacheDir = $sm->getServiceLocator()->get('VuFind\\CacheManager')->getCacheDir(false);
     $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\\Config')->get('HierarchyDefault');
     $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() : [];
     return new Solr($sm->getServiceLocator()->get('VuFind\\Search'), rtrim($cacheDir, '/') . '/hierarchy', $filters);
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:14,代碼來源:Factory.php

示例4: getSolrParams

 /**
  * Factory for Solr params object.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolrParams(ServiceManager $sm)
 {
     $options = $sm->getServiceLocator()->get('VuFind\\SearchOptionsPluginManager')->get('Solr');
     $config = $sm->getServiceLocator()->get('VuFind\\Config');
     $translator = $sm->getServiceLocator()->get('VuFind\\Translator');
     $solr = new \MZKPortal\Search\Solr\Params(clone $options, $config, $translator);
     return $solr;
 }
開發者ID:paulusova,項目名稱:VuFind-2.x,代碼行數:15,代碼來源:Factory.php

示例5: getSolr

 /**
  * Factory for Solr driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolr(ServiceManager $sm)
 {
     $cacheDir = $sm->getServiceLocator()->get('VuFind\\CacheManager')->getCacheDir(false);
     $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\\Config')->get('HierarchyDefault');
     $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() : [];
     $solr = $sm->getServiceLocator()->get('VuFind\\Search\\BackendManager')->get('Solr')->getConnector();
     $formatterManager = $sm->getServiceLocator()->get('VuFind\\HierarchyTreeDataFormatterPluginManager');
     return new Solr($solr, $formatterManager, rtrim($cacheDir, '/') . '/hierarchy', $filters);
 }
開發者ID:grharry,項目名稱:vufind,代碼行數:16,代碼來源:Factory.php

示例6: getLayoutClass

 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     // The right-to-left setting is injected into the layout by the Bootstrapper;
     // pull it back out here to avoid duplicate effort.
     $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel();
     return new LayoutClass($left, $offcanvas, $layout->rtl);
 }
開發者ID:hopeful,項目名稱:vufind,代碼行數:17,代碼來源:Factory.php

示例7: getEDS

 /**
  * Factory for Solr results object.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getEDS(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config');
     $container = new \Zend\Session\Container('EBSCO');
     // No API info in session? Re-establish connection:
     if (!isset($container->info)) {
         $backend = $sm->getServiceLocator()->get('VuFind\\Search\\BackendManager')->get('EDS');
         $backend->getSessionToken();
     }
     $eds = new \VuFind\Search\EDS\Options($config, $container->info);
     return $eds;
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:19,代碼來源:Factory.php

示例8: getHoldingsILS

 public static function getHoldingsILS(ServiceManager $sm)
 {
     // If VuFind is configured to suppress the holdings tab when the
     // ILS driver specifies no holdings, we need to pass in a connection
     // object:
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     if (isset($config->Site->hideHoldingsTabWhenEmpty) && $config->Site->hideHoldingsTabWhenEmpty) {
         $catalog = $sm->getServiceLocator()->get('VuFind\\ILSConnection');
     } else {
         $catalog = false;
     }
     return new HoldingsILS($catalog);
 }
開發者ID:paulusova,項目名稱:VuFind-2.x,代碼行數:13,代碼來源:Factory.php

示例9: getLayoutClass

 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $mirror = !isset($config->Site->mirrorSidebarInRTL) ? true : $config->Site->mirrorSidebarInRTL;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     // The right-to-left setting is injected into the layout by the Bootstrapper;
     // pull it back out here to avoid duplicate effort, then use it to apply
     // the mirror setting appropriately.
     $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel();
     if ($layout->rtl && !$mirror) {
         $left = !$left;
     }
     return new LayoutClass($left, $offcanvas);
 }
開發者ID:steenlibrary,項目名稱:vufind,代碼行數:22,代碼來源:Factory.php

示例10: getLayoutClass

 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     return new LayoutClass($left, $offcanvas);
 }
開發者ID:tillk,項目名稱:vufind,代碼行數:14,代碼來源:Factory.php

示例11: __invoke

 public function __invoke(ServiceManager $container)
 {
     $entityManager = $container->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $options = $this->options;
     $options['object_repository'] = $entityManager->getRepository($options['entity']);
     return new ObjectExists($options);
 }
開發者ID:Fulbis,項目名稱:api,代碼行數:7,代碼來源:ObjectExistsFactory.php

示例12: initUrlQueryHelper

 /**
  * Internal utility function for initializing
  * UrlQueryHelper for a Results-object with search ids for all tabs.
  *
  * @param ResultsManager $results Search results.
  * @param ServiceManager $sm      Service manager.
  *
  * @return Results Search results with initialized UrlQueryHelper
  */
 public static function initUrlQueryHelper(\VuFind\Search\Base\Results $results, $sm)
 {
     $helper = new UrlQueryHelper($results->getParams());
     $savedSearches = $sm->getServiceLocator()->get('Request')->getQuery('search');
     if ($savedSearches) {
         $helper->setDefaultParameter('search', $savedSearches);
     }
     $results->setHelper('urlQuery', $helper);
     return $results;
 }
開發者ID:samuli,項目名稱:vufind-ere,代碼行數:19,代碼來源:Factory.php

示例13: setServiceManager

 /**
  * Set the ZeAuth Service for the plugin/helper class.
  * @param \Zend\ServiceManager\ServiceManager $serviceManager
  * @return \ZeAuth\Service\Auth
  */
 public function setServiceManager(ServiceManager $serviceManager)
 {
     if (!$this->service) {
         if ($serviceManager instanceof \Zend\View\HelperPluginManager) {
             $this->service = $serviceManager->getServiceLocator()->get('ZeAuth');
         } else {
             $this->service = $serviceManager->get('ZeAuth');
         }
     }
     return $this->service;
 }
開發者ID:Ellipizle,項目名稱:dotscms,代碼行數:16,代碼來源:Auth.php

示例14: getUserList

 /**
  * Construct the UserList table.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserList
  */
 public static function getUserList(ServiceManager $sm)
 {
     // For user anonymization console utility
     if (Console::isConsole()) {
         $session = new \Zend\Session\Container('List');
     } else {
         $sessionManager = $sm->getServiceLocator()->get('VuFind\\SessionManager');
         $session = new \Zend\Session\Container('List', $sessionManager);
     }
     return new UserList($session);
 }
開發者ID:bbeckman,項目名稱:NDL-VuFind2,代碼行數:18,代碼來源:Factory.php

示例15: getWorldCatSimilar

 /**
  * Factory for WorldCatSimilar module.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return WorldCatSimilar
  */
 public static function getWorldCatSimilar(ServiceManager $sm)
 {
     return new WorldCatSimilar($sm->getServiceLocator()->get('VuFind\\Search'));
 }
開發者ID:grharry,項目名稱:vufind,代碼行數:11,代碼來源:Factory.php


注:本文中的Zend\ServiceManager\ServiceManager::getServiceLocator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。