function pexpe_add_site($atts, $content = null) {
// 'src' ve 'style' parametrelerini doğrudan kullan
$src = isset($atts['src']) ? esc_url($atts['src']) : '';
$style = isset($atts['style']) ? esc_attr($atts['style']) : '';
// İhbar linkini sadece sayfa id'si mevcutsa oluştur
$ihbar = '';
$page_id = pexpe_page_id_for_lang(pexpe_get_option('contact-page'));
if (!empty($page_id)) {
$ihbar = '<a class="pexpe-ihbar" href="' . esc_url(get_page_link($page_id)) . '">' . esc_html__('Hata Bildir', 'pexpe') . '</a>';
}
// Çıktı HTML kodunu oluştur
$out = '<div class="pexpe-add-site hidden-mobile">
<div class="hidden-mobile">' . sprintf(__('%s Aracını kendi web sitenize eklemek ister misiniz?', 'pexpe'), get_the_title()) . ' ' . do_shortcode($content) . '</div>
<div class="pexpe-add-site-buttons">
<div id="pexpe-copy-code2">
<iframe id="pexpe" src="' . $src . '" style="' . $style . '" scrolling="no"></iframe>
</div>
<div id="pexpe-copy-code">' . esc_html__('Sitene Ekle', 'pexpe') . '</div>
<div class="pexpe-native-share">' . esc_html__('Paylaş', 'pexpe') . '</div>
' . $ihbar . '
</div>
</div>';
// İlgili makaleler fonksiyonunu çağırma
return $out . pexpe_entry_related_articles();
}
// Javascript kodu
add_action('wp_footer', function() {
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
var iframe = document.getElementById('pexpe');
if (iframe) {
window.addEventListener('message', function(e) {
if (e.data && e.data.height) {
iframe.style.height = (parseInt(e.data.height) + 20) + 'px';
}
}, false);
}
});
</script>
<?php
});