EDD_SL_Plugin_Updater.php
6 years ago
ad-ajax.php
6 years ago
ad-debug.php
8 years ago
ad-health-notices.php
6 years ago
ad-model.php
8 years ago
ad-select.php
9 years ago
ad.php
6 years ago
ad_ajax_callbacks.php
6 years ago
ad_group.php
6 years ago
ad_placements.php
6 years ago
ad_type_abstract.php
8 years ago
ad_type_content.php
6 years ago
ad_type_dummy.php
6 years ago
ad_type_group.php
8 years ago
ad_type_image.php
6 years ago
ad_type_plain.php
6 years ago
checks.php
6 years ago
compatibility.php
6 years ago
display-conditions.php
6 years ago
filesystem.php
8 years ago
frontend_checks.php
6 years ago
plugin.php
6 years ago
upgrades.php
6 years ago
utils.php
6 years ago
visitor-conditions.php
6 years ago
widget.php
6 years ago
ad_type_dummy.php
78 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Advanced Ads Dummy Ad Type |
| 4 | * |
| 5 | * @package Advanced_Ads |
| 6 | * @author Thomas Maier <thomas.maier@webgilde.com> |
| 7 | * @license GPL-2.0+ |
| 8 | * @link http://webgilde.com |
| 9 | * @copyright 2014-2017 Thomas Maier, webgilde GmbH |
| 10 | * @since 1.8 |
| 11 | * |
| 12 | * Class containing information about the dummy ad type |
| 13 | * |
| 14 | */ |
| 15 | class Advanced_Ads_Ad_Type_Dummy extends Advanced_Ads_Ad_Type_Abstract{ |
| 16 | |
| 17 | /** |
| 18 | * ID - internal type of the ad type |
| 19 | */ |
| 20 | public $ID = 'dummy'; |
| 21 | |
| 22 | /** |
| 23 | * set basic attributes |
| 24 | */ |
| 25 | public function __construct() { |
| 26 | $this->title = __( 'Dummy', 'advanced-ads' ); |
| 27 | $this->description = __( 'Uses a simple placeholder ad for quick testing.', 'advanced-ads' ); |
| 28 | |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * output for the ad parameters metabox |
| 33 | * |
| 34 | * this will be loaded using ajax when changing the ad type radio buttons |
| 35 | * echo the output right away here |
| 36 | * name parameters must be in the "advanced_ads" array |
| 37 | * |
| 38 | * @param obj $ad ad object |
| 39 | */ |
| 40 | public function render_parameters( $ad ){ |
| 41 | |
| 42 | // don’t show url field if tracking plugin enabled |
| 43 | if( ! defined( 'AAT_VERSION' )) : |
| 44 | $url = ( ! empty( $ad->url ) ) ? esc_attr( $ad->url ) : home_url(); |
| 45 | ?><span class="label"><?php _e( 'URL', 'advanced-ads' ); ?></span> |
| 46 | <div><input type="text" name="advanced_ad[url]" id="advads-url" class="advads-ad-url" value="<?php echo $url; ?>"/></div><hr/> |
| 47 | <?php endif; |
| 48 | |
| 49 | ?><img src="<?php echo ADVADS_BASE_URL ?>public/assets/img/dummy.jpg" width="300" height="250"/><?php |
| 50 | |
| 51 | ?><input type="hidden" name="advanced_ad[width]" value="300"/> |
| 52 | <input type="hidden" name="advanced_ad[height]" value="250"/><?php |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * prepare the ads frontend output |
| 57 | * |
| 58 | * @param obj $ad ad object |
| 59 | * @return str static image content |
| 60 | */ |
| 61 | public function prepare_output($ad){ |
| 62 | |
| 63 | $url = ( isset( $ad->url ) ) ? esc_url( $ad->url ) : ''; |
| 64 | // get general target setting |
| 65 | $options = Advanced_Ads::get_instance()->options(); |
| 66 | $target_blank = !empty( $options['target-blank'] ) ? ' target="_blank"' : ''; |
| 67 | |
| 68 | ob_start(); |
| 69 | if( ! defined( 'AAT_VERSION' ) && $url ){ echo '<a href="'. $url .'"'.$target_blank.'>'; } |
| 70 | echo '<img src="' . ADVADS_BASE_URL . 'public/assets/img/dummy.jpg" width="300" height="250"/>'; |
| 71 | if( ! defined( 'AAT_VERSION' ) && $url ){ echo '</a>'; } |
| 72 | |
| 73 | return ob_get_clean(); |
| 74 | |
| 75 | } |
| 76 | |
| 77 | } |
| 78 |