| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hostinger\LlmsTxtGenerator; |
| 4 |
|
| 5 |
use Hostinger\Admin\PluginSettings; |
| 6 |
|
| 7 |
defined( 'ABSPATH' ) || exit; |
| 8 |
|
| 9 |
class LlmsTxtHeadLink { |
| 10 |
|
| 11 |
protected PluginSettings $plugin_settings; |
| 12 |
protected LlmsTxtFileHelper $file_helper; |
| 13 |
|
| 14 |
public function __construct( PluginSettings $plugin_settings, LlmsTxtFileHelper $llmstxt_file_helper ) { |
| 15 |
$this->plugin_settings = $plugin_settings; |
| 16 |
$this->file_helper = $llmstxt_file_helper; |
| 17 |
} |
| 18 |
|
| 19 |
public function render(): void { |
| 20 |
$settings = $this->plugin_settings->get_plugin_settings(); |
| 21 |
|
| 22 |
if ( ! $settings->get_enable_llms_txt() ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
if ( ! $this->file_helper->llmstxt_file_exists() ) { |
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
printf( '<link rel="describedby" href="%s" />' . "\n", esc_url( $this->file_helper->get_llmstxt_file_url() ) ); |
| 31 |
} |
| 32 |
} |
| 33 |
|