main.php
30 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Prepare content of the 'ads.txt' file. |
| 4 | * |
| 5 | * @package Advanced_Ads_Ads_Txt |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Initializes the ads.txt module for Advanced Ads plugin. |
| 10 | * |
| 11 | * @return void |
| 12 | */ |
| 13 | function advanced_ads_ads_txt_init(): void { |
| 14 | if ( |
| 15 | ! is_multisite() |
| 16 | || ( function_exists( 'is_site_meta_supported' ) && is_site_meta_supported() ) |
| 17 | ) { |
| 18 | |
| 19 | $public = new Advanced_Ads_Ads_Txt_Public( new Advanced_Ads_Ads_Txt_Strategy() ); |
| 20 | |
| 21 | if ( is_admin() ) { |
| 22 | new Advanced_Ads_Ads_Txt_Admin( new Advanced_Ads_Ads_Txt_Strategy(), $public ); |
| 23 | } else { |
| 24 | new Advanced_Ads_Ads_Txt_Public( new Advanced_Ads_Ads_Txt_Strategy() ); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_ads_txt_init' ); |
| 30 |