本文整理汇总了PHP中Bitrix\Main\IO\Path::validateFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::validateFilename方法的具体用法?PHP Path::validateFilename怎么用?PHP Path::validateFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\IO\Path
的用法示例。
在下文中一共展示了Path::validateFilename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadTriggers
private static function loadTriggers($moduleId)
{
static $triggersCache = array();
if (isset($triggersCache[$moduleId])) {
return;
}
if (!IO\Path::validateFilename($moduleId)) {
throw new Main\ArgumentOutOfRangeException("moduleId");
}
$triggersCache[$moduleId] = true;
$path = IO\Path::convertRelativeToAbsolute("/bitrix/modules/" . $moduleId . "/option_triggers.php");
if (!IO\File::isFileExists($path)) {
return;
}
include IO\Path::convertLogicalToPhysical($path);
}
示例2: checkFields
public static function checkFields(Result $result, $primary, array $data)
{
if ($result instanceof Entity\UpdateResult) {
if (isset($data['STORAGE_ID'])) {
$field = static::getEntity()->getField('STORAGE_ID');
$result->addError(new Entity\FieldError($field, Loc::getMessage("DISK_OBJECT_ENTITY_ERROR_UPDATE_STORAGE_ID", array("#FIELD#" => $field->getTitle()))));
}
if (isset($data['PARENT_ID'])) {
$field = static::getEntity()->getField('PARENT_ID');
$result->addError(new Entity\FieldError($field, Loc::getMessage("DISK_OBJECT_ENTITY_ERROR_UPDATE_PARENT_ID", array("#FIELD#" => $field->getTitle()))));
}
}
if (!empty($data['NAME']) && (!IO\Path::validateFilename($data['NAME']) || strpos($data['NAME'], '%') !== false)) {
$field = static::getEntity()->getField('NAME');
$result->addError(new Entity\FieldError($field, Loc::getMessage("DISK_OBJECT_ENTITY_ERROR_FIELD_NAME_HAS_INVALID_CHARS", array("#FIELD#" => $field->getTitle()))));
}
parent::checkFields($result, $primary, $data);
}
示例3: isCorrectName
public function isCorrectName($name, &$msg)
{
if (Path::validateFilename($name) && strpos($name, '%') === false) {
return true;
}
$msg = 'File/Directory name should not have ' . Path::INVALID_FILENAME_CHARS . '%';
return false;
}
示例4: correctObjectName
protected static function correctObjectName($objectName)
{
$objectName = trim($objectName);
if (Path::validateFilename($objectName) && strpos($objectName, '%') === false) {
return $objectName;
}
return preg_replace("#([-" . preg_quote(Path::INVALID_FILENAME_CHARS . '%', "#") . "])#", '_', $objectName);
}