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


PHP HelperPluginManager::getServiceLocator方法代码示例

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


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

示例1: __construct

 public function __construct(HelperPluginManager $pluginManager)
 {
     $this->pluginManager = $pluginManager;
     $this->serviceManager = $pluginManager->getServiceLocator();
     $this->app = $pluginManager->getServiceLocator()->get('Application');
     $this->request = $this->app->getRequest();
     $this->event = $this->app->getMvcEvent();
     $this->em = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
     $this->translator = $this->serviceManager->get('translator');
 }
开发者ID:Belcebur,项目名称:BelceburBasic,代码行数:10,代码来源:BTools.php

示例2: __invoke

 /**
  * @param ContentType|null $contentType
  * @param string|null $contentTypeName
  *
  * @return string
  */
 public function __invoke(ContentType $contentType = null, $contentTypeName = null)
 {
     if (!is_null($contentTypeName)) {
         /** @var GeneralService $generalService */
         $generalService = $this->serviceLocator->getServiceLocator()->get(GeneralService::class);
         $contentType = $generalService->findContentTypeByContentTypeName($contentTypeName);
     }
     if (is_null($contentType)) {
         return null;
     }
     switch (trim($contentType->getContentType())) {
         case 'image/jpeg':
         case 'image/tiff':
         case 'image/png':
             $class = " fa-file-image-o";
             break;
         case 'application/pdf':
         case 'application/postscript':
             $class = "fa-file-pdf-o";
             break;
         case 'application/zip':
         case 'application/x-zip-compressed':
             $class = "fa-file-archive-o";
             break;
         case 'application/vnd.ms-excel':
         case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
         case 'application/vnd.ms-excel.sheet.macroEnabled.12':
             $class = "fa-file-excel-o";
             break;
         case 'application/mspowerpoint':
         case 'application/vnd.ms-powerpoint':
         case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
         case 'application/vnd.openxmlformats-officedocument.presentationml.template':
         case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow':
             $class = 'fa-file-powerpoint-o';
             break;
         case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
         case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
         case 'application/msword':
             $class = "fa-file-word-o";
             break;
         case 'application/octet-stream':
         case 'application/csv':
         case 'text/xml':
             $class = "fa-file-o";
             break;
         case 'video/mp4':
             $class = "fa-file-video-o";
             break;
         default:
             return sprintf('%s not found', $contentType->getContentType());
     }
     return sprintf('<i class="fa %s" title="%s"></i> ', $class, $contentType->getDescription());
 }
开发者ID:iteaoffice,项目名称:general,代码行数:60,代码来源:ContentTypeIcon.php

示例3: createService

 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $this->serviceLocator = $serviceLocator;
     $acl = $this->serviceLocator->getServiceLocator()->get('UthandoUser\\Service\\Acl');
     $identity = $this->getIdentityHelper();
     $role = $identity() ? $identity()->getRole() : 'guest';
     $service = new Navigation();
     $service->setAcl($acl);
     $service->setRole($role);
     $service->setServiceLocator($this->serviceLocator->getServiceLocator());
     return $service;
 }
开发者ID:uthando-cms,项目名称:uthando-navigation,代码行数:18,代码来源:NavigationFactory.php

示例4: __invoke

 /**
  * @param HelperPluginManager $pluginManager
  *
  * @return SymfonyAssetViewHelper
  * @throws \Exception
  */
 public function __invoke(HelperPluginManager $pluginManager)
 {
     $serviceLocator = $pluginManager->getServiceLocator();
     $config = $serviceLocator->get('Config');
     if (false === isset($config['fadoe_symfony_asset_module'])) {
         throw new \Exception('Config not found');
     }
     $config = $config['fadoe_symfony_asset_module'];
     $packagesService = $serviceLocator->get('FaDoe\\SymfonyAssetModule\\PackagesService');
     $version = $config['version'];
     $versionFormat = $config['version_format'];
     $basePath = $config['base_path'];
     $baseUrls = $config['base_urls'];
     $defaultPackage = $packagesService->createService($version, $versionFormat, $basePath, $baseUrls);
     $namedPackages = [];
     foreach ($config['packages'] as $key => $value) {
         $version = $value['version'];
         $versionFormat = $value['version_format'];
         $basePath = $value['base_path'];
         $baseUrls = $value['base_urls'];
         $namedPackages[$key] = $packagesService->createService($version, $versionFormat, $basePath, $baseUrls);
     }
     $packages = new Packages($defaultPackage, $namedPackages);
     return new SymfonyAssetViewHelper($packages);
 }
开发者ID:fadoe,项目名称:symfony-asset-module,代码行数:31,代码来源:SymfonyAssetViewHelperFactory.php

示例5: __invoke

 /**
  * create a link to either
  *
  * @return void
  */
 public function __invoke($provider = null)
 {
     if (!$provider) {
         $pluginManager = $this->getServiceLocator();
         $config = $pluginManager->getServiceLocator()->get('Config');
         $provider = $config['OrgHeiglHybridAuth']['backend'];
     }
     $xhtml = '<a class="hybridauth" href="%2$s">%1$s</a>';
     //$session = new SessionContainer('orgheiglhybridauth');
     $session = $this->viewHelperManager->getServiceLocator()->get('OrgHeiglHybridAuthSession');
     $urlHelper = $this->getViewHelper('url');
     $currentRoute = $this->getCurrentRoute();
     if ($session->offsetExists('authenticated') && true === $session->offsetGet('authenticated')) {
         // Display Logged in information
         $user = $session->offsetGet('user');
         // TODO: This has to be localized
         $user = 'Logout ' . $user->getName();
         $link = $urlHelper('hybridauth/logout', array('redirect' => $currentRoute));
     } else {
         // Display login-button
         // TODO: This has to be localized
         $user = 'Login';
         $link = $urlHelper('hybridauth/login', array('provider' => $provider, 'redirect' => $currentRoute));
     }
     return sprintf($xhtml, $user, $link);
 }
开发者ID:pixelpin,项目名称:heiglhybridauth,代码行数:31,代码来源:HybridAuth.php

示例6: __invoke

 /**
  * createService
  *
  * Create the identity view helper.
  *
  * @param HelperPluginManager  $viewHelperManager  The service manager instance.
  * @param string               $name            The name of the service being created.
  * @param string               $requestedName   The requested name of the service being created.
  *
  * @return Identity
  */
 public function __invoke(HelperPluginManager $viewHelperManager, $name, $requestedName)
 {
     /** @var ServiceManager $serviceManager */
     $serviceManager = $viewHelperManager->getServiceLocator();
     $options = $this->getOptions($serviceManager, $requestedName);
     if (!isset($options['auth_service'])) {
         throw new ServiceNotCreatedException(sprintf('The \'auth_service\' configuration option is missing for view helper \'%s\'.', $requestedName));
     }
     /** @var AuthenticationServiceInterface $authenticationService */
     $authenticationService = $serviceManager->get($options['auth_service']);
     return new Identity($authenticationService);
 }
开发者ID:alex-patterson-webdev,项目名称:arp-auth,代码行数:23,代码来源:IdentityFactory.php

示例7: __invoke

 /**
  * createService
  *
  * Create the form group helper.
  *
  * @param  HelperPluginManager  $viewHelperManager  The view helper plugin manager.
  * @param  string               $name               The name of the service to create.
  * @param  string               $requestedName      The requested name of the service to create.
  *
  * @return FormGroup
  */
 public function __invoke(HelperPluginManager $viewHelperManager, $name, $requestedName)
 {
     /** @var ServiceManager $serviceManager */
     $serviceManager = $viewHelperManager->getServiceLocator();
     $options = $this->getOptions($serviceManager, $requestedName);
     $formRowHelper = $this->defaultRowHelper;
     if (!empty($options['form_row_helper'])) {
         $formRowHelper = $options['form_row_helper'];
     }
     /** @var FormRow $formRow */
     $formRow = $viewHelperManager->get($formRowHelper);
     return new FormGroup($formRow);
 }
开发者ID:alex-patterson-webdev,项目名称:arp-form,代码行数:24,代码来源:FormGroupFactory.php

示例8: getServiceLocator

 /**
  * Get the service locator.
  *
  * @return ServiceLocatorInterface
  */
 public function getServiceLocator()
 {
     return $this->serviceLocator->getServiceLocator();
 }
开发者ID:debranova,项目名称:general,代码行数:9,代码来源:ChallengeHandler.php

示例9: __invoke

 /**
  * @param HelperPluginManager $vhm
  *
  * @return SlugifyViewHelper
  */
 public function __invoke($vhm)
 {
     /** @var Slugify $slugify */
     $slugify = $vhm->getServiceLocator()->get('Cocur\\Slugify\\Slugify');
     return new SlugifyViewHelper($slugify);
 }
开发者ID:ferch01991,项目名称:BlogLaravel,代码行数:11,代码来源:SlugifyViewHelperFactory.php

示例10: factory

 /**
  * @param HelperPluginManager $helperPluginManager
  * @return InsertFile
  */
 public static function factory(HelperPluginManager $helperPluginManager)
 {
     return new static($helperPluginManager->getServiceLocator());
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:8,代码来源:InsertFile.php

示例11: __invoke

 public function __invoke(HelperPluginManager $helperPluginManager)
 {
     $htmlPurifier = $helperPluginManager->getServiceLocator()->get('HTMLPurifier');
     return new PurifierViewHelper($htmlPurifier);
 }
开发者ID:juriansluiman,项目名称:Soflomo-Purifier,代码行数:5,代码来源:PurifierViewHelperFactory.php

示例12: __construct

 public function __construct(HelperPluginManager $helperPluginManager)
 {
     $this->serviceLocator = $helperPluginManager->getServiceLocator();
     $this->pluginLoader = $this->serviceLocator->get("Plugins");
 }
开发者ID:CerebroVasconcelos,项目名称:zf2Plugin,代码行数:5,代码来源:ViewPluginManager.php


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