* @since 1.48.2 */ namespace AdvancedAds\Compatibility; use AdvancedAds\Abstracts\Ad; use AdvancedAds\Interfaces\Ad_Interface; defined( 'ABSPATH' ) || exit; /** * Peepso Ad. */ class Peepso_Ad extends Ad implements Ad_Interface { /** * Prepare output for frontend. * * @return string */ public function prepare_frontend_output(): string { $content = $this->get_content(); $image_id = (int) $this->get_prop( 'image_id' ); $image_url = $image_id ? wp_get_attachment_image_url( $image_id, 'full' ) : false; $image_url = false !== $image_url ? $image_url : null; $avatar_id = (int) $this->get_prop( 'avatar_id' ); $avatar_url = $avatar_id ? wp_get_attachment_image_url( $avatar_id, 'full' ) : false; $avatar_url = false !== $avatar_url ? $avatar_url : null; $url = $this->get_url() ?? '#'; $title = $this->get_title() ?? ''; $title_override = $this->get_prop( 'title_override' ) ?? ''; if ( $title_override && '' !== $title_override ) { $title = $title_override; } ob_start(); ?>
> */ private function get_content_allowed_html(): array { $tags = [ 'a', 'img', 'b', 'i', 'u', 'hr', 'center' ]; if ( class_exists( '\PeepSoAdvancedAdsAdTypePeepSo', false ) ) { $raw = \PeepSoAdvancedAdsAdTypePeepSo::get_allowed_html(); if ( is_string( $raw ) && preg_match_all( '/<\s*([a-z0-9]+)/i', $raw, $matches ) ) { $tags = array_map( 'strtolower', $matches[1] ); } } $attribute_map = [ 'a' => [ 'href' => true, 'title' => true, 'target' => true, 'rel' => true, ], 'img' => [ 'src' => true, 'alt' => true, 'width' => true, 'height' => true, 'class' => true, ], ]; // Keep the paragraphs and line breaks wpautop() adds. $allowed = [ 'p' => [], 'br' => [], ]; foreach ( $tags as $tag ) { $allowed[ $tag ] = $attribute_map[ $tag ] ?? []; } return $allowed; } }