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


PHP Site::getAvailableSites方法代码示例

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


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

示例1: validateAdditionalFields

 /**
  * Checks any additional data that is relevant to this task. If the task
  * class is not relevant, the method is expected to return TRUE
  *
  * @param array $submittedData reference to the array containing the data submitted by the user
  * @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
  * @return boolean True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
 {
     $result = false;
     // validate site
     $sites = Site::getAvailableSites();
     if (array_key_exists($submittedData['site'], $sites)) {
         $result = true;
     }
     // escape limit
     $submittedData['documentsToIndexLimit'] = intval($submittedData['documentsToIndexLimit']);
     return $result;
 }
开发者ID:sascha-egerer,项目名称:ext-solr,代码行数:20,代码来源:IndexQueueWorkerTaskAdditionalFieldProvider.php

示例2: render

 /**
  * @return mixed
  */
 public function render()
 {
     $availableSites = Site::getAvailableSites();
     $currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
     $hasSites = is_array($availableSites) && count($availableSites) > 0;
     $this->templateVariableContainer->add('availableSites', $availableSites);
     $this->templateVariableContainer->add('currentSite', $currentSite);
     $this->templateVariableContainer->add('hasSites', $hasSites);
     $output = $this->renderChildren();
     $this->templateVariableContainer->remove('hasSites');
     $this->templateVariableContainer->remove('currentSite');
     $this->templateVariableContainer->remove('availableSites');
     return $output;
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:17,代码来源:SitesViewHelper.php

示例3: render

 public function render()
 {
     $this->tag->addAttribute('onchange', 'jumpToUrl(document.URL + \'&tx_solr_tools_solradministration[action]=setSite&tx_solr_tools_solradministration[site]=\'+this.options[this.selectedIndex].value,this);');
     $sites = Site::getAvailableSites();
     $currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
     $options = '';
     foreach ($sites as $site) {
         $selectedAttribute = '';
         if ($site == $currentSite) {
             $selectedAttribute = ' selected="selected"';
         }
         $options .= '<option value="' . $site->getRootPageId() . '"' . $selectedAttribute . '>' . $site->getLabel() . '</option>';
     }
     $this->tag->setContent($options);
     return '<div class="docheader-funcmenu siteSelector"><label>Site: </label>' . $this->tag->render() . '</div>';
 }
开发者ID:Gregor-Agnes,项目名称:ext-solr,代码行数:16,代码来源:SiteSelectorMenuViewHelper.php

示例4: resolveSiteHashAllowedSites

 /**
  * Resolves magic keywords in allowed sites configuration.
  * Supported keywords:
  *   __solr_current_site - The domain of the site the query has been started from
  *   __current_site - Same as __solr_current_site
  *   __all - Adds all domains as allowed sites
  *   * - Same as __all
  *
  * @param integer $pageId A page ID that is then resolved to the site it belongs to
  * @param string $allowedSitesConfiguration TypoScript setting for allowed sites
  * @return string List of allowed sites/domains, magic keywords resolved
  */
 public static function resolveSiteHashAllowedSites($pageId, $allowedSitesConfiguration)
 {
     if ($allowedSitesConfiguration == '*' || $allowedSitesConfiguration == '__all') {
         $sites = Site::getAvailableSites();
         $domains = array();
         foreach ($sites as $site) {
             $domains[] = $site->getDomain();
         }
         $allowedSites = implode(',', $domains);
     } else {
         $allowedSites = str_replace(array('__solr_current_site', '__current_site'), Site::getSiteByPageId($pageId)->getDomain(), $allowedSitesConfiguration);
     }
     return $allowedSites;
 }
开发者ID:stmllr,项目名称:ext-solr,代码行数:26,代码来源:Util.php

示例5: validateAdditionalFields

 /**
  * Checks any additional data that is relevant to this task. If the task
  * class is not relevant, the method is expected to return TRUE
  *
  * @param array $submittedData reference to the array containing the data submitted by the user
  * @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
  * @return bool True if validation was ok (or selected class is not relevant), FALSE otherwise
  */
 public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
 {
     $result = false;
     // validate site
     $sites = Site::getAvailableSites();
     if (array_key_exists($submittedData['site'], $sites)) {
         $result = true;
     }
     return $result;
 }
开发者ID:sitegeist,项目名称:ext-solr,代码行数:18,代码来源:ReIndexTaskAdditionalFieldProvider.php

示例6: initializeAction

 /**
  * Initializes resources commonly needed for several actions
  *
  * @return void
  */
 protected function initializeAction()
 {
     try {
         $site = $this->request->getArgument('site');
         if (is_numeric($site)) {
             $siteRootPageId = $this->request->getArgument('site');
             $this->site = Site::getSiteByPageId($siteRootPageId);
         } else {
             if ($site instanceof Site) {
                 $this->site = $site;
             }
         }
     } catch (NoSuchArgumentException $nsae) {
         $sites = Site::getAvailableSites();
         $site = array_shift($sites);
         $this->site = $site;
     }
     $this->request->setArgument('site', $this->site);
     $moduleData = $this->moduleDataStorageService->loadModuleData();
     $moduleData->setSite($this->site);
     $this->moduleDataStorageService->persistModuleData($moduleData);
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:27,代码来源:AbstractModuleController.php

示例7: canGetAllSites

 /**
  * @test
  */
 public function canGetAllSites()
 {
     $this->importDataSetFromFixture('can_get_all_sites.xml');
     $sites = Site::getAvailableSites();
     $this->assertSame(1, count($sites), 'Expected to retrieve one site from fixture');
 }
开发者ID:kalypso63,项目名称:ext-solr,代码行数:9,代码来源:SiteTest.php


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