Automattic\WooCommerce\Internal\ProductFeed\Storage
JsonFileFeed::is_valid_feed_identifier
Checks that a feed identifier is a plain feed file name, not a path.
Identifiers round-trip through the persisted status option and are accepted by the public {@see delete()}, so a corrupted or hostile value (e.g. containing ../) must never be concatenated into a path that escapes the feed directory.
Метод класса: JsonFileFeed{}
Хуков нет.
Возвращает
bool. True if the identifier is a safe, plain .json file name.
Использование
$result = JsonFileFeed::is_valid_feed_identifier( $identifier ): bool;
- $identifier(строка) (обязательный)
- The feed file identifier to check.
Код JsonFileFeed::is_valid_feed_identifier() JsonFileFeed::is valid feed identifier WC 11.2.2
private static function is_valid_feed_identifier( string $identifier ): bool {
return '' !== $identifier
&& wp_basename( $identifier ) === $identifier
&& 'json' === strtolower( (string) pathinfo( $identifier, PATHINFO_EXTENSION ) );
}