| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/web20/web/wp-content/themes/old_backup/ |
Upload File : |
<?php
require_once("config/config.php");
$oSP = new SuperPost($post);
$sOfferASA = get_post_meta($post->ID, 'offer_asa');
if(isset($sOfferASA[0]) && $post->post_type == "produkte") {
$oAmazon = new AmazonSimpleAdmin();
$oAmazonItem = $oAmazon->getItemObject($sOfferASA[0]);
add_filter('aioseop_description', 'br_custom_description');
}
get_header();
$oCategory = get_the_category($post->ID);
$sProducts = false;
?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="container content-container">
<?php //if (function_exists('nav_breadcrumb')) nav_breadcrumb();
// Taxonomien zum Produkt
$iParentID = $post->post_parent != 0 ? $post->parent : $post->ID; // Hauptkategorie ermitteln
$aOfferTerms = wp_get_object_terms($post->ID, 'producttaxonomies', array('orderby' => 'date', 'order' => 'DESC'));
$aOfferParent = wp_list_pluck($aOfferTerms, 'parent');
$aOfferTerms = wp_list_pluck($aOfferTerms, 'term_id');
$aOfferTerms = array_merge($aOfferTerms, $aOfferParent);
// Produkt-ID gesetzt? Dann Amazon
if(isset($sOfferASA[0])) {
// Ähnliche Produkte finden
$sProducts = get_related_content($post, 'produkte');
$sContents = get_related_content($post, 'post');
$aShop = get_shop_categories(array('post'=>$aOfferTerms, 'width' => 12, 'width_item' => 12));
$sTitle = get_the_title($post->ID);
// Produktbeschreibung aus vorhandenem Material aus der Amazon API zusammentragen
if(!empty($oAmazonItem->EditorialReviews[0]->Content) && strlen($oAmazonItem->EditorialReviews[0]->Content) > 60) {
$sAmazonContent = strip_tags(edit_product_content(preg_replace("#(\<br\>|\<br \/\>|\<br\/\>)#i", " ", $oAmazonItem->EditorialReviews[0]->Content), false));
$sAmazonContent = preg_replace('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', "", $sAmazonContent);
$aProductShortDescription = explode('. ', $sAmazonContent);
} else if(!empty($oAmazonItem->Feature)) {
$sAmazonFeature = strip_tags(preg_replace("#(\<br\>|\<br \/\>|\<br\/\>)#i", " ", implode('. ', edit_product_content($oAmazonItem->Feature, false))));
$sAmazonContent = preg_replace('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', "", $sAmazonContent);
$aProductShortDescription = explode('. ', str_replace("..", ". ", $sAmazonFeature));
}
// Kurzbeschreibung zur Ausgabe vorbereiten
$sProductShortDescription = implode('. ', array($aProductShortDescription[0], $aProductShortDescription[1]));
// Wenn Beschreibung aus Amazon generierten Text zu kurz ist
if(!empty($sProductShortDescription) && strlen($sProductShortDescription) < 180 && !empty($post->post_content)) {
$sProductShortDescription = preg_replace("#(\<br\>|\<br \/\>|\<br\/\>)#i", " ", implode(' - ', $aProductShortDescription));
$sPostContent = strip_tags($post->post_content);
$sProductShortDescription = strlen($sPostContent) > 250 ? $sProductShortDescription.' '.substr($sPostContent, 0, (250-strlen($sProductShortDescription))).'... ' : $sPostContent;
}
// Wenn Beschreibung aus Amazon generierten Text leer ist
else if(empty($sProductShortDescription)) {
$sProductShortDescription = false;
}
// Text aus Amazon Text generieren
else {
$bCreateExcerpt = true;
$sProductShortDescription = strlen($sProductShortDescription) > 250 ? substr($sProductShortDescription, 0, 250).'... ' : (strlen($sProductShortDescription) < 5 ? false : $sProductShortDescription);
}
// Produktbeschreibung aktualisieren, falls noch nicht geschehen
if (!has_excerpt() && isset($bCreateExcerpt)) {
$my_post = array(
'ID' => $post->ID,
'post_excerpt' => $sProductShortDescription,
);
wp_update_post($my_post); // Produkt mit Kurzbeschreibung vervollständigen
}
// Post Excerpt setzen, falls noch nicht aus DB geladen
$sPostExcerpt = !has_excerpt() ? $sProductShortDescription : $post->post_excerpt;
$sPostContent = substr($sPostContent, strlen($sPostContent)-1, strlen($sPostContent)) == "." ? $sPostContent : $sPostContent.".";
// WP Content formatieren
$sGetContent = get_the_content();
$sGetContent = apply_filters('the_content', $sGetContent);
// Generierten Einleitungstext mit Post_Excerpt vergleichen in Prozent
similar_text($sPostExcerpt, $sProductShortDescription, $iSimilarText);
// Links der Kategorie erstellen
$aFooterCategories = array(); $sFooterCategorie = false;
// Titel vor Ausgabe Formatieren
$sFormattedTitle = preg_replace("#\([^\)]*\)#", "", edit_product_content($post->post_title));
$sFormattedTitleShort = getFirstWords(str_replace(array(' -', ' und ', ' mit ', ' inklusive ', ' für ', ' oder ', ' ', 'Größe', 'größe', 'Farbe:'), ' ', $sFormattedTitle), 3);
foreach($aCategories_query as $k => $v) {
$aFooterCategories[] = '<strong><a href="'.$cpt_onomy->get_term_link(intval($v->term_id), 'producttaxonomies').'" title="'.$sFormattedTitleShort.' in '.$v->name.' kaufen">'.$v->name.'</a></strong>';
} $iFooterCategories = count($aFooterCategories);
if(count($aFooterCategories) > 1) {
$sFooterCategorie = ' und '.$aFooterCategories[$iFooterCategories-1];
unset($aFooterCategories[$iFooterCategories-1]);
}
// Offer Bar anzeigen
ob_start();
get_offer_bar(10);
$sNavigate = ob_get_contents();
ob_end_clean();
$aPlaceholder = array(
'WP_Title' => $sTitle,
'WP_Permalink' => "/offer/".$post->ID.".html",
'WP_PostID' => $post->ID,
'WP_Excerpt' => $sGetContent,
'WP_Image' => get_amazon_image($sOfferASA[0]),
'WP_Links' => isset($sLinkWidget) ? $sLinkWidget : false,
'WP_Products' => $sProducts.get_sidebar_shop().(preg_match("/alkohol/",strtolower($sTitle)) ? get_sidebar_stats(true) : false).get_sidebar_blog(),
'WP_Text' => ($iSimilarText >= 50 ? false : $sPostExcerpt),
'WP_Category' => strip_tags($aFooterCategories[0]),
'SEO_CONTENT' => get_adsense_bar(),
);
// Produktverfügbarkeit auslesen
$sProductAvailability = !empty($oAmazonItem->Offers->Offers[0]->Availability) ? str_replace(array('Gewöhnlich ', 'versandfertig in', 'Versandfertig', 'Zur'), array('gewöhnlich ', 'versandfertig in nur', 'versandfertig', 'zur'), $oAmazonItem->Offers->Offers[0]->Availability) : false;
?>
<!--<div class="product-container-info">
<p><?php echo $sPostExcerpt; ?><?php if($sProductShortDescription != false) { echo ' Lesen Sie die vollständige Produktbeschreibung <a href="#productDetails" title="'.$sFormattedTitle.' Produktbeschreibung">hier</a>.<br />'; } ?>
<strong><?php echo $sFormattedTitleShort; ?></strong><?php echo !empty($sProductAvailability) ? " ist <em>".$sProductAvailability."</em> und genauso wie unsere anderen Angebote in " : " ist in "; ?><?php echo implode(', ', $aFooterCategories).$sFooterCategorie; ?> im Onlineshop erhältlich.</p>
</div>-->
<?php echo asa_shortcode_handler(array('single'), $sOfferASA[0], false, $aPlaceholder);
} else { ?>
<div class="col-md-9 col-content">
<div class="content">
<h1 class="widget-title"><?php echo $post->post_title; ?></h1>
<?php } ?>
<?php if(!isset($sOfferASA[0])) {
$singleFull = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
if($sOfferLink['link']) {
$sOfferPrice = get_post_meta($post->ID, 'offer_price');
?>
<div class="product-container">
<div class="list-info-container">
<div class="col-md-3 center">
<?php
$singleThumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
?>
<a href="<?php echo $singleFull[0]; ?>" class="fancybox" rel="blog_image" title="<?php the_title(); ?>">
<img alt="<?php echo the_title(); ?>" src="<?php echo $singleThumb[0]; ?>" class="img-responsive" style="border: 1px solid #AAA;" />
</a>
</div>
<div class="product-container-span col-md-9">
<div class="affiliate-headline col-md-12">
<h3><?php the_title(); ?></h3>
</div>
<?php
// Affiliate Preis ausgeben (Wird im Backend manuell festgelegt)
if(isset($sOfferPrice[0])) {
$fString = strpos($sOfferPrice[0],"%"); ?>
<div class="affiliate-row">
<div class="col-xs-4 bold">Preis</div>
<div class="col-xs-8 price"><?php if($fString!==false) { echo "bis zu "; } ?><?php echo $sOfferPrice[0]; ?><?php if($fString===false) { echo " Euro"; } else { echo " sparen"; } ?></div>
</div>
<?php }
// Affiliate Bewertungen ausgeben
$sReviewStars = get_post_meta($post->ID, 'review_stars');
$sReviewCount = get_post_meta($post->ID, 'review_count');
if(isset($sReviewStars[0]) && $sReviewCount[0]) {
$sRoundStars = round(str_replace(',', '.', $sReviewStars[0]), 0, PHP_ROUND_HALF_UP);
?>
<div class="affiliate-row">
<div class="col-xs-4 bold">Bewertung</div>
<div class="col-xs-8">
<?php
for ($i = 1; $i <= $sRoundStars; $i++) {
echo '<i class="fa fa-star"></i>';
}
for ($i2 = 1; $i2 <= (5-$sRoundStars); $i2++) {
echo '<i class="fa fa-star-o"></i>';
}
echo " ".$sReviewStars[0]; ?> Sterne<br />
<?php echo $sReviewCount[0]; ?> Kundenmeinungen
</div>
<?php } ?>
</div>
<div class="affiliate-row">
<div class="offer-prices">
<a class="btn" target="_blank" rel="nofollow" href="<?php echo (substr($sOfferLink['original'][0], 0, 1) === "#" ? $sOfferLink['original'][0] : $sOfferLink['link']); ?>" onclick="setTimeout(function() { affiliatetracking('<?php echo basename(get_permalink()); ?>') },200);"><?php
if($oSP->getOfferName()) {
echo (substr($sOfferLink['original'][0], 0, 1) === "#" ? '<i class="icon-double-angle-down"></i> ' : false).$oSP->getOfferName(); // Alternative Linkbezeichnung
} else {
echo 'weiter zum Produkt';
}
?></a>
</div>
</div>
</div>
</div>
</div>
<div style="clear:both;display:none;"> </div>
<?php } else {
$singleMedium = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' );
?>
<div class="alignleft">
<a href="<?php echo $singleFull[0]; ?>" title="<?php echo the_title(); ?>" class="fancybox" rel="blog_article">
<img src="<?php echo $singleMedium[0]; ?>" alt="<?php the_title(); ?>" class="img-responsive" />
</a>
</div><?php }
// Linkwidget anzeigen
echo $sLinkWidget;
the_content();
$sReviewStars = get_post_meta($post->ID, 'review_stars');
$sReviewCount = get_post_meta($post->ID, 'review_count');
if(!isset($sReviewStars[0]) && !isset($sReviewCount[0])) {
$sReviewStars[0] = f_rand(3.2, 5);
$sReviewCount[0] = rand(7, 140);
add_post_meta($post->ID, 'review_stars', $sReviewStars[0]);
add_post_meta($post->ID, 'review_count', $sReviewCount[0]);
}
?>
<div class="row">
<div class="col-md-12 meta-datas">
<div class="col-md-6">
<?php if(isset($sReviewStars[0]) && isset($sReviewCount[0])) {
$sRoundStars = round(str_replace(',', '.', $sReviewStars[0]), 0, PHP_ROUND_HALF_UP); ?>
<div class="review">
<strong>Bewertung:</strong> <?php
for ($i = 1; $i <= $sRoundStars; $i++) {
echo '<i class="fa fa-star"></i>';
}
for ($i2 = 1; $i2 <= (5-$sRoundStars); $i2++) {
echo '<i class="fa fa-star-o"></i>';
}
?><br />
<?php echo number_format($sReviewStars[0], 1, ',', '.'); ?> Sterne, auf der Grundlage von <?php echo $sReviewCount[0]; ?> Stimmen
</div>
<?php } ?>
</div>
<div class="col-md-6 right">
<em>Veröffentlicht am <?php the_time('d.m.Y'); ?></em>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
// Affiliate Angebote einblenden
//get_template_part('loop', 'affiliate');
?>
<?php
// Produkte anzeigen (deaktiviert ja / nein?)
$sHideProducts = get_post_meta($post->ID, 'hide_products');
if(empty($sHideProducts) || (isset($sOfferASA[0]) && !isset($sProducts))) get_template_part('loop', 'products');
get_template_part( 'loop', 'related' );
?>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
</body>
</html>