本文整理匯總了PHP中Gdn_Format::Clean方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Format::Clean方法的具體用法?PHP Gdn_Format::Clean怎麽用?PHP Gdn_Format::Clean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::Clean方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _checkName
protected function _checkName($n)
{
$Result = parent::_checkName($n);
$Extension = pathinfo($Result, 4);
$Name = pathinfo($Result, 8);
$Result = Gdn_Format::Clean($Name) . '.' . Gdn_Format::Clean($Extension);
$Result = trim($Result, '.');
return $Result;
}
示例2: GenerateCleanTargetName
function GenerateCleanTargetName($TargetFolder, $Name, $Extension = '', $TempFile = False, $bForceOverwriteExisting = False)
{
if ($Extension == '') {
$Extension = pathinfo($Name, 4);
$Name = pathinfo($Name, 8);
}
$Extension = Gdn_Format::Clean($Extension);
$BaseName = Gdn_Format::Clean($Name);
// check for file with same name
$TestName = $BaseName;
$TargetFile = $TargetFolder . DS . $TestName . '.' . $Extension;
if (!file_exists($TargetFile)) {
return $TargetFile;
}
$IsSameFile = $TempFile != False && file_exists($TempFile) && Crc32File($TempFile) == Crc32File($TargetFile);
if ($IsSameFile || $bForceOverwriteExisting) {
return $TargetFile;
}
$Count = 0;
$NameSuffix = '';
do {
//if (++$Count > 100) $NameSuffix = mt_rand(100, 9999);
if (++$Count > 250) {
throw new Exception('Cannot generate unique name for file.');
}
// make sure that iteration will end
$TargetFile = $TargetFolder . '/' . $TestName . $NameSuffix . '.' . $Extension;
$FileExists = file_exists($TargetFile);
if ($FileExists && file_exists($TempFile) && md5_file($TargetFile) == md5_file($TempFile)) {
break;
}
$NameSuffix = '-' . $Count;
} while ($FileExists);
return $TargetFile;
}
示例3: CleanupString
/**
* CleanupString function from Vanilla I
*/
function CleanupString($String)
{
return Gdn_Format::Clean($String);
}