abstracts
2 months ago
admin
2 months ago
ads
3 months ago
compatibility
3 months ago
crons
3 months ago
frontend
2 months ago
groups
3 months ago
importers
2 months ago
installation
1 year ago
interfaces
4 months ago
license
3 months ago
placements
3 months ago
rest
1 year ago
traits
4 months ago
utilities
3 months ago
array_ad_conditions.php
1 year ago
cap_map.php
3 years ago
class-assets-registry.php
3 months ago
class-autoloader.php
1 year ago
class-constants.php
1 year ago
class-content-injector.php
2 months ago
class-entities.php
3 months ago
class-modal.php
1 year ago
class-modules.php
1 year ago
class-options.php
1 year ago
class-plugin.php
2 months ago
class-post-data.php
10 months ago
class-shortcodes.php
2 months ago
class-upgrades.php
1 year ago
class-widget.php
11 months ago
default-hooks.php
4 months ago
functions-ad.php
1 year ago
functions-components.php
3 months ago
functions-conditional.php
1 year ago
functions-core.php
1 year ago
functions-group.php
1 year ago
functions-placement.php
1 year ago
functions.php
3 months ago
index.php
2 years ago
load_modules.php
2 years ago
array_ad_conditions.php
96 lines
| 1 | <?php // phpcs:ignoreFile |
| 2 | |
| 3 | /** |
| 4 | * Conditions under which to (not) show an ad |
| 5 | * I don’t like huge arrays like this to clutter my classes |
| 6 | * and anyway, this might be needed on multiple places |
| 7 | * at the bottom, you find a filter to be able to extend / remove your own elements |
| 8 | * |
| 9 | * Elements |
| 10 | * key - internal id of the condition; needs to be unique, obviously |
| 11 | * label - title in the dashboard |
| 12 | * description - (optional) description displayed in the dashboard |
| 13 | * type - information / markup type |
| 14 | * idfield - input field for comma separated lists of ids |
| 15 | * radio - radio button |
| 16 | * others - added to not trigger internal sanitization |
| 17 | * |
| 18 | * note: ’idfield’ always has a {field}_not version that is created automatically and being its own condition |
| 19 | * |
| 20 | * @deprecated since 1.7 |
| 21 | * @package AdvancedAds |
| 22 | */ |
| 23 | |
| 24 | defined( 'ABSPATH' ) || exit; |
| 25 | |
| 26 | if ( ! class_exists( 'Advanced_Ads', false ) ) { |
| 27 | die(); |
| 28 | } |
| 29 | |
| 30 | $advanced_ads_ad_conditions = [ |
| 31 | 'enabled' => [ |
| 32 | 'type' => 'other', |
| 33 | ], |
| 34 | 'posttypes' => [ |
| 35 | 'label' => __( 'Post Types', 'advanced-ads' ), |
| 36 | 'description' => __( 'Choose the public post types on which to display the ad.', 'advanced-ads' ), |
| 37 | 'type' => 'textvalues', |
| 38 | 'callback' => [ 'Advanced_Ads_Display_Condition_Callbacks', 'post_types'] |
| 39 | ], |
| 40 | 'categoryids' => [ |
| 41 | 'label' => __( 'Categories, Tags and Taxonomies', 'advanced-ads' ), |
| 42 | 'description' => __( 'Choose terms from public category, tag and other taxonomies a post must belong to in order to have ads.', 'advanced-ads' ), |
| 43 | 'type' => 'idfield', |
| 44 | 'callback' => [ 'Advanced_Ads_Display_Condition_Callbacks', 'terms'] |
| 45 | ], |
| 46 | 'categoryarchiveids' => [ |
| 47 | 'label' => __( 'Category Archives', 'advanced-ads' ), |
| 48 | 'description' => __( 'comma seperated IDs of category archives', 'advanced-ads' ), |
| 49 | 'type' => 'idfield', |
| 50 | 'callback' => [ 'Advanced_Ads_Display_Condition_Callbacks', 'category_archives'] |
| 51 | ], |
| 52 | 'postids' => [ |
| 53 | 'label' => __( 'Individual Posts, Pages and Public Post Types', 'advanced-ads' ), |
| 54 | 'description' => __( 'Choose on which individual posts, pages and public post type pages you want to display or hide ads.', 'advanced-ads' ), |
| 55 | 'type' => 'other', |
| 56 | 'callback' => [ 'Advanced_Ads_Display_Condition_Callbacks', 'single_posts'] |
| 57 | ], |
| 58 | 'is_front_page' => [ |
| 59 | 'label' => __( 'Home Page', 'advanced-ads' ), |
| 60 | 'description' => __( 'show on Home page', 'advanced-ads' ), |
| 61 | 'type' => 'radio', |
| 62 | ], |
| 63 | 'is_singular' => [ |
| 64 | 'label' => __( 'Singular Pages', 'advanced-ads' ), |
| 65 | 'description' => __( 'show on singular pages/posts', 'advanced-ads' ), |
| 66 | 'type' => 'radio', |
| 67 | ], |
| 68 | 'is_archive' => [ |
| 69 | 'label' => __( 'Archive Pages', 'advanced-ads' ), |
| 70 | 'description' => __( 'show on any type of archive page (category, tag, author and date)', 'advanced-ads' ), |
| 71 | 'type' => 'radio', |
| 72 | ], |
| 73 | 'is_search' => [ |
| 74 | 'label' => __( 'Search Results', 'advanced-ads' ), |
| 75 | 'description' => __( 'show on search result pages', 'advanced-ads' ), |
| 76 | 'type' => 'radio', |
| 77 | ], |
| 78 | 'is_404' => [ |
| 79 | 'label' => __( '404 Page', 'advanced-ads' ), |
| 80 | 'description' => __( 'show on 404 error page', 'advanced-ads' ), |
| 81 | 'type' => 'radio', |
| 82 | ], |
| 83 | 'is_attachment' => [ |
| 84 | 'label' => __( 'Attachment Pages', 'advanced-ads' ), |
| 85 | 'description' => __( 'show on attachment pages', 'advanced-ads' ), |
| 86 | 'type' => 'radio', |
| 87 | ], |
| 88 | 'is_main_query' => [ |
| 89 | 'label' => __( 'Secondary Queries', 'advanced-ads' ), |
| 90 | 'description' => __( 'allow ads in secondary queries', 'advanced-ads' ), |
| 91 | 'type' => 'radio', |
| 92 | ], |
| 93 | ]; |
| 94 | |
| 95 | return apply_filters( 'advanced-ads-conditions', $advanced_ads_ad_conditions ); |
| 96 |