debug: add logging to rail ads rendering
This commit is contained in:
@@ -97,6 +97,9 @@ function roi_render_rail_ads(): string
|
|||||||
global $container;
|
global $container;
|
||||||
|
|
||||||
if ($container === null) {
|
if ($container === null) {
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: container is NULL');
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,22 +108,34 @@ function roi_render_rail_ads(): string
|
|||||||
$settings = $repository->getComponentSettings('adsense-placement');
|
$settings = $repository->getComponentSettings('adsense-placement');
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: settings are EMPTY');
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verificar exclusiones
|
// Verificar exclusiones
|
||||||
if (roi_is_ad_excluded($settings)) {
|
if (roi_is_ad_excluded($settings)) {
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: EXCLUDED by roi_is_ad_excluded');
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtener renderer desde DIContainer (DIP compliant)
|
// Obtener renderer desde DIContainer (DIP compliant)
|
||||||
$renderer = $container->getAdsensePlacementRenderer();
|
$renderer = $container->getAdsensePlacementRenderer();
|
||||||
|
|
||||||
return $renderer->renderRailAds($settings);
|
$html = $renderer->renderRailAds($settings);
|
||||||
|
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: renderRailAds returned ' . strlen($html) . ' chars');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
error_log('ROI AdSense Rail Ads: ' . $e->getMessage());
|
error_log('ROI AdSense Rail Ads ERROR: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -130,8 +145,19 @@ function roi_render_rail_ads(): string
|
|||||||
* Hook para inyectar Rail Ads en el footer
|
* Hook para inyectar Rail Ads en el footer
|
||||||
*/
|
*/
|
||||||
add_action('wp_footer', function() {
|
add_action('wp_footer', function() {
|
||||||
|
// DEBUG: Verificar que el hook se ejecuta
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: wp_footer hook fired');
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = roi_render_rail_ads();
|
||||||
|
|
||||||
|
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||||
|
error_log('ROI Rail Ads: output length = ' . strlen($output));
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
echo roi_render_rail_ads();
|
echo $output;
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user