main.php
25 lines
| 1 | <?php //phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols -- the sniff does not accept calling add_action and declaring the callback in the same file |
| 2 | |
| 3 | // Only load if not already existing (maybe included from another plugin). |
| 4 | if ( defined( 'ADVADS_AB_BASE_PATH' ) ) { |
| 5 | return; |
| 6 | } |
| 7 | |
| 8 | // load basic path to the plugin |
| 9 | define( 'ADVADS_AB_BASE_PATH', plugin_dir_path( __FILE__ ) ); |
| 10 | // general and global slug, e.g. to store options in WP, textdomain |
| 11 | define( 'ADVADS_AB_SLUG', 'advanced-ads-ab-module' ); |
| 12 | |
| 13 | add_action( 'advanced-ads-plugin-loaded', 'advanced_ads_load_adblocker' ); |
| 14 | |
| 15 | /** |
| 16 | * Load ad blocker functionality. |
| 17 | */ |
| 18 | function advanced_ads_load_adblocker() { |
| 19 | Advanced_Ads_Ad_Blocker::get_instance(); |
| 20 | |
| 21 | if ( is_admin() && ! wp_doing_ajax() ) { |
| 22 | Advanced_Ads_Ad_Blocker_Admin::get_instance(); |
| 23 | } |
| 24 | } |
| 25 |