Yoast\WP\SEO\Llms_Txt\Infrastructure\File
WordPress_File_System_Adapter::get_llms_file_path
Creates the path to the llms.txt file.
Метод класса: WordPress_File_System_Adapter{}
Хуки из метода
Возвращает
Строку.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_llms_file_path(): string;
Код WordPress_File_System_Adapter::get_llms_file_path() WordPress File System Adapter::get llms file path Yoast 28.3
private function get_llms_file_path(): string {
$llms_filesystem_path = \get_home_path();
// phpcs:disable WordPress.Security.ValidatedSanitizedInput -- Reason: This is how we used this for the robots.txt file as well.
if ( ! \is_writable( $llms_filesystem_path ) && ! empty( $_SERVER['DOCUMENT_ROOT'] ) ) {
$llms_filesystem_path = $_SERVER['DOCUMENT_ROOT'];
}
// phpcs:enable WordPress.Security.ValidatedSanitizedInput
/**
* Filter: 'wpseo_llmstxt_filesystem_path' - Allows editing the filesystem path of the llmst.txt file to account for server restrictions to the filesystem.
*
* @param string $llms_filesystem_path The filesystem path of the llmst.txt file that defaults to get_home_path() or the $_SERVER['DOCUMENT_ROOT'] if the home path is not writeable.
*/
$llms_filesystem_path = \apply_filters( 'wpseo_llmstxt_filesystem_path', $llms_filesystem_path );
return \trailingslashit( $llms_filesystem_path ) . 'llms.txt';
}