WPSEO_File_Size_Service::calculate_file_size()protectedYoast 1.0

Calculates the file size using the Utils class.

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

Хуков нет.

Возвращает

int|true|false. The file size or False if it could not be retrieved.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->calculate_file_size( $file_url );
$file_url(строка) (обязательный)
The file to retrieve the size for.

Код WPSEO_File_Size_Service::calculate_file_size() Yoast 22.1

protected function calculate_file_size( $file_url ) {
	return WPSEO_Image_Utils::get_file_size(
		[
			'path' => $file_url,
		]
	);
}