diff options
Diffstat (limited to 'plugins/jetpack/modules/wordads/class-wordads.php')
-rw-r--r-- | plugins/jetpack/modules/wordads/class-wordads.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/jetpack/modules/wordads/class-wordads.php b/plugins/jetpack/modules/wordads/class-wordads.php index 0cb0df9d..4a73322b 100644 --- a/plugins/jetpack/modules/wordads/class-wordads.php +++ b/plugins/jetpack/modules/wordads/class-wordads.php @@ -207,13 +207,14 @@ class WordAds { WordAds_California_Privacy::init(); } - if ( '/ads.txt' === $_SERVER['REQUEST_URI'] ) { + if ( isset( $_SERVER['REQUEST_URI'] ) && '/ads.txt' === $_SERVER['REQUEST_URI'] ) { - $ads_txt_transient = get_transient( 'jetpack_ads_txt' ); + $ads_txt_transient = get_transient( 'wordads_ads_txt' ); if ( false === ( $ads_txt_transient ) ) { - $ads_txt_transient = ! is_wp_error( WordAds_API::get_wordads_ads_txt() ) ? WordAds_API::get_wordads_ads_txt() : ''; - set_transient( 'jetpack_ads_txt', $ads_txt_transient, DAY_IN_SECONDS ); + $wordads_ads_txt = WordAds_API::get_wordads_ads_txt(); + $ads_txt_transient = is_wp_error( $wordads_ads_txt ) ? '' : $wordads_ads_txt; + set_transient( 'wordads_ads_txt', $ads_txt_transient, DAY_IN_SECONDS ); } /** @@ -359,9 +360,10 @@ class WordAds { $data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : ''; $site_id = $this->params->blog_id; $consent = (int) isset( $_COOKIE['personalized-ads-consent'] ); + $is_logged_in = is_user_logged_in() ? '1' : '0'; ?> <script<?php echo esc_attr( $data_tags ); ?> type="text/javascript"> - var __ATA_PP = { pt: <?php echo esc_js( $pagetype ); ?>, ht: <?php echo esc_js( $hosting_type ); ?>, tn: '<?php echo esc_js( get_stylesheet() ); ?>', amp: false, siteid: <?php echo esc_js( $site_id ); ?>, consent: <?php echo esc_js( $consent ); ?>, ad: { label: { text: '<?php echo esc_js( __( 'Advertisements', 'jetpack' ) ); ?>' }, reportAd: { text: '<?php echo esc_js( __( 'Report this ad', 'jetpack' ) ); ?>' } } }; + var __ATA_PP = { pt: <?php echo esc_js( $pagetype ); ?>, ht: <?php echo esc_js( $hosting_type ); ?>, tn: '<?php echo esc_js( get_stylesheet() ); ?>', uloggedin: <?php echo esc_js( $is_logged_in ); ?>, amp: false, siteid: <?php echo esc_js( $site_id ); ?>, consent: <?php echo esc_js( $consent ); ?>, ad: { label: { text: '<?php echo esc_js( __( 'Advertisements', 'jetpack' ) ); ?>' }, reportAd: { text: '<?php echo esc_js( __( 'Report this ad', 'jetpack' ) ); ?>' } } }; var __ATA = __ATA || {}; __ATA.cmd = __ATA.cmd || []; __ATA.criteo = __ATA.criteo || {}; |