当前位置: 首页>>代码示例>>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;未经允许,请勿转载。