class-aawp-ad.php
1 week ago
class-aawp.php
1 year ago
class-admin-compatibility.php
1 week ago
class-capability-manager.php
1 year ago
class-compatibility.php
1 week ago
class-inline-js.php
1 year ago
class-peepso-ad.php
1 week ago
class-peepso.php
1 week ago
class-peepso-ad.php
90 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Peepso Compatibility. |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.48.2 |
| 8 | */ |
| 9 | |
| 10 | namespace AdvancedAds\Compatibility; |
| 11 | |
| 12 | use AdvancedAds\Abstracts\Ad; |
| 13 | use AdvancedAds\Interfaces\Ad_Interface; |
| 14 | |
| 15 | defined( 'ABSPATH' ) || exit; |
| 16 | |
| 17 | /** |
| 18 | * Peepso Ad. |
| 19 | */ |
| 20 | class Peepso_Ad extends Ad implements Ad_Interface { |
| 21 | |
| 22 | /** |
| 23 | * Prepare output for frontend. |
| 24 | * |
| 25 | * @return string |
| 26 | */ |
| 27 | public function prepare_frontend_output(): string { |
| 28 | $content = $this->get_content(); |
| 29 | |
| 30 | $image_id = (int) $this->get_prop( 'image_id' ); |
| 31 | $image_url = $image_id ? wp_get_attachment_image_url( $image_id, 'full' ) : false; |
| 32 | $image_url = $image_url ?: null; |
| 33 | |
| 34 | $avatar_id = (int) $this->get_prop( 'avatar_id' ); |
| 35 | $avatar_url = $avatar_id ? wp_get_attachment_image_url( $avatar_id, 'full' ) : false; |
| 36 | $avatar_url = $avatar_url ?: null; |
| 37 | |
| 38 | $url = $this->get_url() ?? '#'; |
| 39 | $title = $this->get_title() ?? ''; |
| 40 | $title_override = $this->get_prop( 'title_override' ) ?? ''; |
| 41 | if ( $title_override && '' !== $title_override ) { |
| 42 | $title = $title_override; |
| 43 | } |
| 44 | |
| 45 | ob_start(); |
| 46 | ?> |
| 47 | <div class="ps-post__header"> |
| 48 | <?php if ( $avatar_url ) : ?> |
| 49 | <a class="ps-avatar ps-avatar--post" target="_blank" href="<?php echo esc_url( $url ); ?>"> |
| 50 | <img src="<?php echo esc_url( $avatar_url ); ?>" alt="" /> |
| 51 | </a> |
| 52 | <?php endif; ?> |
| 53 | <div class="ps-post__meta"> |
| 54 | <div class="ps-post__title"> |
| 55 | <a target="_blank" href="<?php echo esc_url( $url ); ?>"> |
| 56 | <?php echo $title; // phpcs:ignore ?> |
| 57 | </a> |
| 58 | </div> |
| 59 | <div class="ps-post__info"> |
| 60 | <?php |
| 61 | if ( \PeepSo::get_option( 'advancedads_stream_sponsored_mark', 0 ) ) { |
| 62 | echo \PeepSo::get_option( 'advancedads_stream_sponsored_text' ); // phpcs:ignore |
| 63 | } |
| 64 | ?> |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | |
| 69 | <div class="ps-post__body"> |
| 70 | <div class="ps-post__content"> |
| 71 | <?php |
| 72 | $allow_tags = \PeepSo::get_option_new( 'advanced_ads_allow_all_tags' ); |
| 73 | echo $allow_tags |
| 74 | ? $content // phpcs:ignore |
| 75 | : wpautop( strip_tags( $content, \PeepSoAdvancedAdsAdTypePeepSo::get_allowed_html() ) ); // phpcs:ignore |
| 76 | ?> |
| 77 | </div> |
| 78 | |
| 79 | <?php if ( $image_url ) : ?> |
| 80 | <a target="_blank" class="ps-advads__image" href="<?php echo esc_url( $url ); ?>"> |
| 81 | <img src="<?php echo esc_url( $image_url ); ?>" alt="" /> |
| 82 | </a> |
| 83 | <?php endif; ?> |
| 84 | </div> |
| 85 | |
| 86 | <?php |
| 87 | return ob_get_clean(); |
| 88 | } |
| 89 | } |
| 90 |