本文整理汇总了PHP中F::Crc32方法的典型用法代码示例。如果您正苦于以下问题:PHP F::Crc32方法的具体用法?PHP F::Crc32怎么用?PHP F::Crc32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::Crc32方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _makeSubdir
/**
* @param string $sDir
*
* @return string
*/
protected function _makeSubdir($sDir)
{
if (!isset($this->aMapDir[$sDir])) {
$this->aMapDir[$sDir] = F::Crc32($sDir, true);
}
return $this->aMapDir[$sDir];
}
示例2: AssetFileHashDir
/**
* Calculate hash of file's dirname
*
* @param string $sFile
*
* @return string
*/
public function AssetFileHashDir($sFile)
{
if (substr($sFile, -1) == '/') {
$sDir = $sFile;
} else {
$sDir = dirname($sFile);
}
return F::Crc32($sDir, true);
}
示例3: AssetFilePath
/**
* Make path of asset file
*
* @param string $sLocalFile
* @param string $sParentDir
*
* @return string
*/
public function AssetFilePath($sLocalFile, $sParentDir = null)
{
if ($n = strpos($sLocalFile, '?')) {
$sBasename = basename(substr($sLocalFile, 0, $n)) . '-' . F::Crc32(substr($sLocalFile, $n));
$sExtension = F::File_GetExtension($sLocalFile);
if ($sExtension) {
$sBasename .= '.' . $sExtension;
}
} else {
$sBasename = basename($sLocalFile);
}
$sResult = $this->AssetFileHashDir($sLocalFile) . '/' . $sBasename;
if ($sParentDir) {
if (substr($sParentDir, -1) != '/') {
$sParentDir .= '/';
}
$sResult = $sParentDir . $sResult;
}
return $sResult;
}
示例4: _convertUrlsInCss
protected function _convertUrlsInCss($sContent, $sSourceDir)
{
// Есть ли в файле URLs
if (!preg_match_all('/(?P<src>src:)?url\\((?P<url>.*?)\\)/is', $sContent, $aMatchedUrl, PREG_OFFSET_CAPTURE)) {
return $sContent;
}
// * Обрабатываем список URLs
$aUrls = array();
foreach ($aMatchedUrl['url'] as $nIdx => $aPart) {
$sPath = $aPart[0];
//$nPos = $aPart[1];
// * Don't touch data URIs
if (strstr($sPath, 'data:')) {
continue;
}
$sPath = str_replace(array('\'', '"'), '', $sPath);
// * Если путь является абсолютным, то не обрабатываем
if (substr($sPath, 0, 1) == "/" || substr($sPath, 0, 5) == 'http:' || substr($sPath, 0, 6) == 'https:') {
continue;
}
if (($n = strpos($sPath, '?')) || ($n = strpos($sPath, '#'))) {
$sPath = substr($sPath, 0, $n);
$sFileParam = substr($sPath, $n);
} else {
$sFileParam = '';
}
if (!isset($aUrls[$sPath])) {
// if url didn't prepare...
$sRealPath = realpath($sSourceDir . $sPath);
if ($sRealPath) {
$sDestination = F::File_GetAssetDir() . F::Crc32(dirname($sRealPath), true) . '/' . basename($sRealPath);
$aUrls[$sPath] = array('source' => $sRealPath, 'destination' => $sDestination, 'url' => E::ModuleViewerAsset()->AssetFileDir2Url($sDestination) . $sFileParam);
F::File_Copy($sRealPath, $sDestination);
}
}
}
if ($aUrls) {
$sContent = str_replace(array_keys($aUrls), F::Array_Column($aUrls, 'url'), $sContent);
}
return $sContent;
}
示例5: GetCachePrefix
/**
* @return string
*/
public function GetCachePrefix()
{
$sUniqKey = C::Get(C::ALTO_UNIQUE_KEY);
if (!$sUniqKey) {
$sUniqKey = E::ModuleSecurity()->GenerateUniqKey();
}
return C::Get('sys.cache.prefix') . '_' . F::Crc32($sUniqKey, true);
}
示例6: CreateUuid
/**
* @param string $sStorage
* @param string $sFileName
* @param string $sFileHash
* @param int $iUserId
*
* @return string
*/
public static function CreateUuid($sStorage, $sFileName, $sFileHash, $iUserId)
{
$sUuid = '0u' . F::Crc32($iUserId . ':' . $sFileHash, true) . '-' . F::Crc32($sStorage . ':' . $sFileName . ':' . $iUserId, true) . '-' . F::Crc32($sStorage . ':' . $sFileHash . ':' . $sFileName, true);
return $sUuid;
}