HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/public_html/wp-content/plugins/give/build/Campaigns/Blocks/CampaignCover/render.php
<?php

use Give\Campaigns\Models\Campaign;
use Give\Campaigns\Repositories\CampaignRepository;

if (!isset($attributes['campaignId'])) {
    return;
}

/** @var Campaign $campaign */
$campaign = give(CampaignRepository::class)->getById($attributes['campaignId']);

if (!$campaign || !$campaign->image) {
    return;
}

$campaignMediaSetting = $campaign->image;

$altText = $attributes['alt'] ?? __('Campaign cover image', 'give');
$alignment = isset($attributes['align']) ? 'align' . $attributes['align'] : '';
$borderRadius = "border-radius: 8px;";

// Only assign width and height if the alignment is NOT "full" or "wide"
if ($attributes['align'] !== 'full' && $attributes['align'] !== 'wide') {
    $widthStyle = isset($attributes['width']) ? "width: {$attributes['width']}px;" : '';
    $heightStyle = isset($attributes['height']) ? "max-height: {$attributes['height']}px;" : '';
} else {
    $widthStyle = 'width: 100%;';
    $heightStyle = 'height: auto;';
    $borderRadius = '';
}
?>

<div
    <?php echo wp_kses_data(get_block_wrapper_attributes()); ?>
>
    <figure class="givewp-campaign-cover-block__figure">
        <img
            src="<?php echo esc_url($campaign->image); ?>"
            alt="<?php echo esc_attr($altText); ?>"
            style="<?php echo trim(esc_attr($widthStyle) . esc_attr($heightStyle) . esc_attr($borderRadius)); ?>"
        />
    </figure>
</div>