# hostinger/3.0.39/includes/LlmsTxtGenerator/LlmsTxtFileHelper.php

Hostinger Tools, version 3.0.39. 58 lines.

- Page: https://pluginprobe.com/plugins/hostinger/3.0.39/code/includes/LlmsTxtGenerator/LlmsTxtFileHelper.php
- Raw: https://pluginprobe.com/plugins/hostinger/3.0.39/raw/includes/LlmsTxtGenerator/LlmsTxtFileHelper.php
- Modified: 2025-06-12T12:05:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/hostinger/3.0.39/code/includes/LlmsTxtGenerator/LlmsTxtFileHelper.php#L10-L20`.

```php
<?php

namespace Hostinger\LlmsTxtGenerator;

defined( 'ABSPATH' ) || exit;

class LlmsTxtFileHelper {

	public const HOSTINGER_LLMSTXT_FILENAME = 'llms.txt';

	public function is_user_generated_file(): bool {
		if ( ! $this->llmstxt_file_exists() ) {
			return false;
		}

		global $wp_filesystem;
		$this->init_wp_filesystem();
		$content = $wp_filesystem->get_contents( $this->get_llmstxt_file_path() );

		if ( $content === false ) {
			return false;
		}

		return ! str_contains( $content, LlmsTxtGenerator::HOSTINGER_LLMSTXT_SIGNATURE );
	}

	public function create( string $content ): void {
		global $wp_filesystem;
		$this->init_wp_filesystem();
		$wp_filesystem->put_contents( $this->get_llmstxt_file_path(), $content );
	}

	public function delete(): void {
		if ( $this->llmstxt_file_exists() && ! $this->is_user_generated_file() ) {
			global $wp_filesystem;
			$this->init_wp_filesystem();
			$wp_filesystem->delete( $this->get_llmstxt_file_path() );
		}
	}

	public function get_llmstxt_file_path(): string {
		return ABSPATH . self::HOSTINGER_LLMSTXT_FILENAME;
	}

	public function get_llmstxt_file_url(): string {
		return site_url( LlmsTxtFileHelper::HOSTINGER_LLMSTXT_FILENAME );
	}

	public function llmstxt_file_exists(): bool {
		return file_exists( $this->get_llmstxt_file_path() );
	}

	protected function init_wp_filesystem(): void {
		require_once ABSPATH . '/wp-admin/includes/file.php';
		WP_Filesystem();
	}
}

```
