diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index 741c58a413969..26ebb777f9d7f 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -380,7 +380,6 @@ 'modules/shortcodes/ustream.php' => ['PhanTypeMismatchArgument'], 'modules/shortcodes/vimeo.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'], 'modules/shortcodes/vr.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], - 'modules/shortcodes/wordads.php' => ['PhanNoopNew'], 'modules/shortcodes/youtube.php' => ['PhanRedefineFunction'], 'modules/shortlinks.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'modules/simple-payments/simple-payments.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], diff --git a/projects/plugins/jetpack/changelog/update-iponweb-to-watl-migration b/projects/plugins/jetpack/changelog/update-iponweb-to-watl-migration index 57bf248955ab6..c66b2abb063ef 100644 --- a/projects/plugins/jetpack/changelog/update-iponweb-to-watl-migration +++ b/projects/plugins/jetpack/changelog/update-iponweb-to-watl-migration @@ -1,5 +1,5 @@ Significance: patch Type: other -Migration from IPONWEB to WATL -* Render legacy sidebar widget with the WATL +Migration of ad formats from IPONWEB to WATL + diff --git a/projects/plugins/jetpack/extensions/blocks/wordads/wordads.php b/projects/plugins/jetpack/extensions/blocks/wordads/wordads.php index 9107adf5cd600..e1d4b6ce3b8cc 100644 --- a/projects/plugins/jetpack/extensions/blocks/wordads/wordads.php +++ b/projects/plugins/jetpack/extensions/blocks/wordads/wordads.php @@ -139,12 +139,12 @@ public static function gutenblock_render( $attr ) { $format = $attr['format']; } - $height = $ad_tag_ids[ $format ]['height']; - $width = $ad_tag_ids[ $format ]['width']; - $gutenberg_location = 'gutenberg'; - $snippet = $wordads->get_ad_snippet( $section_id, $height, $width, $gutenberg_location, $wordads->get_solo_unit_css() ); + $height = $ad_tag_ids[ $format ]['height']; + $width = $ad_tag_ids[ $format ]['width']; + $location = 'gutenberg'; + $snippet = $wordads->get_ad_snippet( $section_id, $height, $width, $location, $wordads->get_solo_unit_css() ); - $key = "{$gutenberg_location}_{$width}x{$height}"; + $key = "{$location}_{$width}x{$height}"; $smart_format = self::$gutenberg_ad_snippet_x_smart_format[ $key ] ?? null; // phpcs:disable WordPress.Security.NonceVerification.Recommended $is_watl_enabled = $smart_format && ( isset( $_GET[ $smart_format ] ) && 'true' === $_GET[ $smart_format ] ); diff --git a/projects/plugins/jetpack/modules/wordads/class-wordads.php b/projects/plugins/jetpack/modules/wordads/class-wordads.php index 9d796910a78aa..81e0ed53afd3e 100644 --- a/projects/plugins/jetpack/modules/wordads/class-wordads.php +++ b/projects/plugins/jetpack/modules/wordads/class-wordads.php @@ -21,6 +21,7 @@ require_once WORDADS_ROOT . '/php/class-wordads-ccpa-do-not-sell-link-widget.php'; require_once WORDADS_ROOT . '/php/class-wordads-consent-management-provider.php'; require_once WORDADS_ROOT . '/php/class-wordads-smart.php'; +require_once WORDADS_ROOT . '/php/class-wordads-shortcode.php'; /** * Primary WordAds class. @@ -215,6 +216,9 @@ public function init() { WordAds_Consent_Management_Provider::init(); } + // Initialize [wordads] shortcode. + WordAds_Shortcode::init(); + // Initialize Smart. WordAds_Smart::instance()->init( $this->params ); @@ -527,8 +531,17 @@ public function insert_inline_ad( $content ) { } $ad_type = $this->option( 'wordads_house' ) ? 'house' : 'iponweb'; - $content .= $this->get_ad( 'inline', $ad_type ); - return $content; + $location = 'shortcode'; + // not house ad and watl enabled + // phpcs:disable WordPress.Security.NonceVerification.Recommended + if ( 'house' !== $ad_type && ( isset( $_GET['wordads-logging'] ) && isset( $_GET[ $location ] ) && 'true' === $_GET[ $location ] ) ) { + return $content . $this->get_watl_ad_html_tag( $location ); + } + + return $content .= sprintf( + '