array_ad_conditions.php
88 lines
| 1 | <?php |
| 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 | * |
| 8 | * at the bottom, you find a filter to be able to extend / remove your own elements |
| 9 | * |
| 10 | * elements |
| 11 | * key - internal id of the condition; needs to be unique, obviously |
| 12 | * label - title in the dashboard |
| 13 | * description - (optional) description displayed in the dashboard |
| 14 | * type - information / markup type |
| 15 | * idfield - input field for comma separated lists of ids |
| 16 | * radio - radio button |
| 17 | * others - added to not trigger internal sanitization |
| 18 | * |
| 19 | * note: ’idfield’ always has a {field}_not version that is created automatically and being its own condition |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | $advanced_ads_slug = Advanced_Ads::get_instance()->get_plugin_slug(); |
| 24 | |
| 25 | $advanced_ads_ad_conditions = array( |
| 26 | 'enabled' => array( // dummy, to let the validation of the general ad conditions past |
| 27 | // 'label' => __('Post Types', $advanced_ads_slug), |
| 28 | // 'description' => __('Choose the public post types on which to display the ad.', $advanced_ads_slug), |
| 29 | 'type' => 'other', |
| 30 | // 'callback' => array('AdvAds_Display_Condition_Callbacks', 'post_types') |
| 31 | ), |
| 32 | 'posttypes' => array( |
| 33 | 'label' => __('Post Types', $advanced_ads_slug), |
| 34 | 'description' => __('Choose the public post types on which to display the ad.', $advanced_ads_slug), |
| 35 | 'type' => 'textvalues', |
| 36 | 'callback' => array('AdvAds_Display_Condition_Callbacks', 'post_types') |
| 37 | ), |
| 38 | 'categoryids' => array( |
| 39 | 'label' => __('Categories, Tags and Taxonomies', $advanced_ads_slug), |
| 40 | 'description' => __('Choose terms from public category, tag and other taxonomies a post must belong to in order to have ads.', $advanced_ads_slug), |
| 41 | 'type' => 'idfield', |
| 42 | 'callback' => array('AdvAds_Display_Condition_Callbacks', 'terms') |
| 43 | ), |
| 44 | 'categoryarchiveids' => array( |
| 45 | 'label' => __('Category Archives', $advanced_ads_slug), |
| 46 | 'description' => __('comma seperated IDs of category archives', $advanced_ads_slug), |
| 47 | 'type' => 'idfield', |
| 48 | 'callback' => array('AdvAds_Display_Condition_Callbacks', 'category_archives') |
| 49 | ), |
| 50 | 'postids' => array( |
| 51 | 'label' => __('Individual Posts, Pages and Public Post Types', $advanced_ads_slug), |
| 52 | 'description' => __('Choose on which individual posts, pages and public post type pages you want to display or hide ads.', $advanced_ads_slug), |
| 53 | 'type' => 'other', |
| 54 | 'callback' => array('AdvAds_Display_Condition_Callbacks', 'single_posts') |
| 55 | ), |
| 56 | 'is_front_page' => array( |
| 57 | 'label' => __('Home Page', $advanced_ads_slug), |
| 58 | 'description' => __('(don\'t) show on Home page', $advanced_ads_slug), |
| 59 | 'type' => 'radio', |
| 60 | ), |
| 61 | 'is_singular' => array( |
| 62 | 'label' => __('Singular Pages', $advanced_ads_slug), |
| 63 | 'description' => __('(don\'t) show on singular pages/posts', $advanced_ads_slug), |
| 64 | 'type' => 'radio', |
| 65 | ), |
| 66 | 'is_archive' => array( |
| 67 | 'label' => __('Archive Pages', $advanced_ads_slug), |
| 68 | 'description' => __('(don\'t) show on any type of archive page (category, tag, author and date)', $advanced_ads_slug), |
| 69 | 'type' => 'radio', |
| 70 | ), |
| 71 | 'is_search' => array( |
| 72 | 'label' => __('Search Results', $advanced_ads_slug), |
| 73 | 'description' => __('(don\'t) show on search result pages', $advanced_ads_slug), |
| 74 | 'type' => 'radio', |
| 75 | ), |
| 76 | 'is_404' => array( |
| 77 | 'label' => __('404 Page', $advanced_ads_slug), |
| 78 | 'description' => __('(don\'t) show on 404 error page', $advanced_ads_slug), |
| 79 | 'type' => 'radio', |
| 80 | ), |
| 81 | 'is_attachment' => array( |
| 82 | 'label' => __('Attachment Pages', $advanced_ads_slug), |
| 83 | 'description' => __('(don\'t) show on attachment pages', $advanced_ads_slug), |
| 84 | 'type' => 'radio', |
| 85 | ) |
| 86 | ); |
| 87 | |
| 88 | $advanced_ads_ad_conditions = apply_filters('advanced-ads-conditions', $advanced_ads_ad_conditions); |