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


PHP Util::getSiteHashForDomain方法代碼示例

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


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

示例1: getSiteHashForDomain

 /**
  * @test
  */
 public function getSiteHashForDomain()
 {
     $oldKey = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'testKey';
     $hash1 = Util::getSiteHashForDomain('www.test.de');
     $hash2 = Util::getSiteHashForDomain('www.test.de');
     $this->assertEquals('b17ca8164881e80e96a96529c16b19cc405c9bd0', $hash1);
     $this->assertEquals('b17ca8164881e80e96a96529c16b19cc405c9bd0', $hash2);
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $oldKey;
 }
開發者ID:sitegeist,項目名稱:ext-solr,代碼行數:13,代碼來源:UtilTest.php

示例2: setSiteHashFilter

 /**
  * Limits the query to certain sites
  *
  * @param string $allowedSites Comma-separated list of domains
  */
 public function setSiteHashFilter($allowedSites)
 {
     $allowedSites = GeneralUtility::trimExplode(',', $allowedSites);
     $filters = array();
     foreach ($allowedSites as $site) {
         $siteHash = Util::getSiteHashForDomain($site);
         $filters[] = 'siteHash:"' . $siteHash . '"';
     }
     $this->addFilter(implode(' OR ', $filters));
 }
開發者ID:Gregor-Agnes,項目名稱:ext-solr,代碼行數:15,代碼來源:Query.php

示例3: getSiteHash

 /**
  * Generates the site's unique Site Hash.
  *
  * The Site Hash is build from the site's main domain, the system encryption
  * key, and the extension "tx_solr". These components are concatenated and
  * sha1-hashed.
  *
  * @return string Site Hash.
  */
 public function getSiteHash()
 {
     return Util::getSiteHashForDomain($this->getDomain());
 }
開發者ID:kalypso63,項目名稱:ext-solr,代碼行數:13,代碼來源:Site.php

示例4: header

 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
/*
	Provides the sitehash for a given domain, valid for the current TYPO3
	installation.
	Example: http://www.my-typo3-solr-installation.com/index.php?eID=tx_solr_api&api=siteHash&apiKey=<API key>&domain=www.domain-to-index.com
*/
use ApacheSolrForTypo3\Solr\Util;
use TYPO3\CMS\Core\Utility\HttpUtility;
$domain = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('domain');
$returnData = '';
if (!empty($domain)) {
    $siteHash = Util::getSiteHashForDomain($domain);
    $returnData = json_encode(array('sitehash' => $siteHash));
} else {
    header(HttpUtility::HTTP_STATUS_400);
    $errorMessage = 'You have to provide an existing domain, e.g. www.example.com.';
    $returnData = json_encode(array('errorMessage' => $errorMessage));
}
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Content-Type: application/json; charset=utf-8');
header('Content-Transfer-Encoding: 8bit');
header('Content-Length: ' . strlen($returnData));
echo $returnData;
開發者ID:Gregor-Agnes,項目名稱:ext-solr,代碼行數:31,代碼來源:SiteHash.php


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