本文整理汇总了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);
}