type-amp.php
1 year ago
type-content.php
10 months ago
type-dummy.php
1 year ago
type-gam.php
1 year ago
type-group.php
1 year ago
type-image.php
1 year ago
type-plain.php
1 year ago
type-unknown.php
1 year ago
type-dummy.php
120 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This class represents the "Dummy" ad type. |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.48.0 |
| 8 | */ |
| 9 | |
| 10 | namespace AdvancedAds\Ads\Types; |
| 11 | |
| 12 | use AdvancedAds\Ads\Ad_Dummy; |
| 13 | use AdvancedAds\Interfaces\Ad_Type; |
| 14 | |
| 15 | defined( 'ABSPATH' ) || exit; |
| 16 | |
| 17 | /** |
| 18 | * Type Dummy. |
| 19 | */ |
| 20 | class Dummy implements Ad_Type { |
| 21 | |
| 22 | /** |
| 23 | * Get the unique identifier (ID) of the ad type. |
| 24 | * |
| 25 | * @return string The unique ID of the ad type. |
| 26 | */ |
| 27 | public function get_id(): string { |
| 28 | return 'dummy'; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Get the class name of the object as a string. |
| 33 | * |
| 34 | * @return string |
| 35 | */ |
| 36 | public function get_classname(): string { |
| 37 | return Ad_Dummy::class; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get the title or name of the ad type. |
| 42 | * |
| 43 | * @return string The title of the ad type. |
| 44 | */ |
| 45 | public function get_title(): string { |
| 46 | return __( 'Dummy', 'advanced-ads' ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get a description of the ad type. |
| 51 | * |
| 52 | * @return string The description of the ad type. |
| 53 | */ |
| 54 | public function get_description(): string { |
| 55 | return __( 'Uses a simple placeholder ad for quick testing.', 'advanced-ads' ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Check if this ad type requires premium. |
| 60 | * |
| 61 | * @return bool True if premium is required; otherwise, false. |
| 62 | */ |
| 63 | public function is_premium(): bool { |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Get the URL for upgrading to this ad type. |
| 69 | * |
| 70 | * @return string The upgrade URL for the ad type. |
| 71 | */ |
| 72 | public function get_upgrade_url(): string { |
| 73 | return ''; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Get the URL for upgrading to this ad type. |
| 78 | * |
| 79 | * @return string The upgrade URL for the ad type. |
| 80 | */ |
| 81 | public function get_image(): string { |
| 82 | return ADVADS_BASE_URL . 'assets/img/ad-types/dummy.svg'; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Check if this ad type has size parameters. |
| 87 | * |
| 88 | * @return bool True if has size parameters; otherwise, false. |
| 89 | */ |
| 90 | public function has_size(): bool { |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Output for the ad parameters metabox |
| 96 | * |
| 97 | * @param Ad_Dummy $ad Ad instance. |
| 98 | * |
| 99 | * @return void |
| 100 | */ |
| 101 | public function render_parameters( $ad ): void { |
| 102 | if ( ! defined( 'AAT_VERSION' ) ) : |
| 103 | $url = $ad->get_url() ?? home_url(); |
| 104 | ?> |
| 105 | <span class="label"><?php esc_html_e( 'URL', 'advanced-ads' ); ?></span> |
| 106 | <div> |
| 107 | <input type="text" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo esc_url( $url ); ?>" /> |
| 108 | </div> |
| 109 | <hr/> |
| 110 | <?php |
| 111 | endif; |
| 112 | ?> |
| 113 | |
| 114 | <img src="<?php echo esc_url( ADVADS_BASE_URL ) . 'public/assets/img/dummy.jpg'; ?>" alt="" width="300" height="250" /> |
| 115 | <input type="hidden" name="advanced_ad[width]" value="300" /> |
| 116 | <input type="hidden" name="advanced_ad[height]" value="250" /> |
| 117 | <?php |
| 118 | } |
| 119 | } |
| 120 |