HEX
Server: LiteSpeed
System: Linux br-asc-web1845.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
User: u790421558 (790421558)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //proc/self/cwd/wp-content/plugins/hostinger/includes/LlmsTxtGenerator/LlmsTxtFileHelper.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;
        }

        $content = $this->get_content();

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

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

    public function get_content(): string {
        global $wp_filesystem;
        $this->init_wp_filesystem();
        return $wp_filesystem->get_contents( $this->get_llmstxt_file_path() );
    }

    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();
    }
}