<?php

function dacdb_riThemeLogo($atts)
{

    // Enqueue styles
    wp_enqueue_style('show-riThemeLogo', MMPDB_PLUGIN_URL . 'css/show-riThemeLogo.css', array('dacdb-bootstrap'), MMPDB_PLUGIN_VERSION, 'all');


    // Determine the color theme for the image
    $color = isset($atts['theme']) && ($atts['theme'] == 'black' || $atts['theme'] == 'white') ? $atts['theme'] : 'color';
    $image_url = 'https://cdn.jsdelivr.net/gh/memberminderpro/rotary-brand-assets@latest/img/theme/' . $color . '.svg';

    // Handle width attribute
    $width = isset($atts['width']) ? $atts['width'] : '100%';
    if (is_numeric($width)) {
        $width .= 'px'; // Default to pixels if no unit is specified
    }

    // Handle height attribute
    $height = isset($atts['height']) ? $atts['height'] : 'auto';
    if (is_numeric($height)) {
        $height .= 'px'; // Default to pixels if no unit is specified
    }

    // Generate the HTML output
    $html = '
    <div class="theme">
        <a href="https://www.rotary.org/en/about-rotary" title="About Rotary" target="_blank" rel="noopener"><img src="' . esc_url($image_url) . '" alt="The Rotary International Presidential Theme Logo" class="ri-theme-logo" style="width:' . esc_attr($width) . '; height:' . esc_attr($height) . ';"></a>
    </div>';
    return $html;
}
