WC_Product_Download::set_file()publicWC 1.0

Set file.

Метод класса: WC_Product_Download{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Product_Download = new WC_Product_Download();
$WC_Product_Download->set_file( $value );
$value(строка) (обязательный)
File URL/Path.

Код WC_Product_Download::set_file() WC 8.7.0

public function set_file( $value ) {
	// A `///` is recognized as an "absolute", but on the filesystem, so it bypasses the mime check in `self::is_allowed_filetype`.
	// This will strip extra prepending / to the maximum of 2.
	if ( preg_match( '#^//+(/[^/].+)$#i', $value, $matches ) ) {
		$value = $matches[1];
	}
	switch ( $this->get_type_of_file_path( $value ) ) {
		case 'absolute':
			$this->data['file'] = esc_url_raw( $value );
			break;
		default:
			$this->data['file'] = wc_clean( $value );
			break;
	}
}