diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index efac808922c06..ff949e9e27a61 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -33,7 +33,6 @@ // PhanTypeArraySuspicious : 20+ occurrences // PhanTypeMismatchDimFetch : 20+ occurrences // PhanSuspiciousMagicConstant : 15+ occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 15+ occurrences // PhanTypeMismatchPropertyDefault : 15+ occurrences // PhanTypeSuspiciousNonTraversableForeach : 15+ occurrences // PhanPluginDuplicateExpressionAssignmentOperation : 10+ occurrences @@ -56,7 +55,6 @@ // PhanCommentAbstractOnInheritedMethod : 6 occurrences // PhanDeprecatedClass : 5 occurrences // PhanImpossibleCondition : 5 occurrences - // PhanNonClassMethodCall : 5 occurrences // PhanTypeMismatchDimAssignment : 5 occurrences // PhanAccessMethodInternal : 4 occurrences // PhanTypeInvalidLeftOperandOfAdd : 4 occurrences @@ -72,6 +70,7 @@ // PhanTypeObjectUnsetDeclaredProperty : 3 occurrences // PhanUndeclaredMethodInCallable : 3 occurrences // PhanImpossibleConditionInLoop : 2 occurrences + // PhanNonClassMethodCall : 2 occurrences // PhanParamTooMany : 2 occurrences // PhanParamTooManyCallable : 2 occurrences // PhanPluginDuplicateSwitchCaseLooseEquality : 2 occurrences @@ -192,7 +191,7 @@ 'extensions/blocks/story/story.php' => ['PhanImpossibleCondition', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable'], 'extensions/blocks/subscriptions/subscriptions.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'extensions/blocks/top-posts/top-posts.php' => ['PhanTypeMismatchReturnProbablyReal'], - 'extensions/blocks/wordads/wordads.php' => ['PhanNonClassMethodCall', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgument'], + 'extensions/blocks/wordads/wordads.php' => ['PhanTypeMismatchArgument'], 'extensions/plugins/sharing/sharing.php' => ['PhanRedundantCondition'], 'functions.compat.php' => ['PhanRedefineFunction'], 'functions.global.php' => ['PhanRedefineFunction', 'PhanRedundantCondition', 'PhanSuspiciousMagicConstant', 'PhanTypeMismatchArgument'], @@ -447,11 +446,11 @@ 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-my-account.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait'], 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-trait.php' => ['PhanDeprecatedFunction', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredMethod'], 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait', 'PhanPluginRedundantAssignment'], - 'modules/wordads/class-wordads.php' => ['PhanNonClassMethodCall', 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyProbablyReal'], + 'modules/wordads/class-wordads.php' => ['PhanPluginRedundantAssignment', 'PhanTypeMismatchArgument'], 'modules/wordads/php/class-wordads-admin.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'modules/wordads/php/class-wordads-api.php' => ['PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'modules/wordads/php/class-wordads-params.php' => ['PhanTypeMismatchReturn'], - 'modules/wordads/php/class-wordads-sidebar-widget.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgument'], + 'modules/wordads/php/class-wordads-sidebar-widget.php' => ['PhanTypeMismatchArgument'], 'sal/class.json-api-date.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanRedundantCondition', 'PhanTypeMismatchArgumentInternalProbablyReal'], 'sal/class.json-api-links.php' => ['PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'sal/class.json-api-post-base.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanTypeSuspiciousNonTraversableForeach'], diff --git a/projects/plugins/jetpack/changelog/add-aditude-support-for-gutenberg b/projects/plugins/jetpack/changelog/add-aditude-support-for-gutenberg new file mode 100644 index 0000000000000..a249d961ec08f --- /dev/null +++ b/projects/plugins/jetpack/changelog/add-aditude-support-for-gutenberg @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +WordAds: Support Gutenberg Ad block for Aditude diff --git a/projects/plugins/jetpack/modules/wordads/class-wordads.php b/projects/plugins/jetpack/modules/wordads/class-wordads.php index d57bf2e5471de..4e3f7124d0db3 100644 --- a/projects/plugins/jetpack/modules/wordads/class-wordads.php +++ b/projects/plugins/jetpack/modules/wordads/class-wordads.php @@ -31,7 +31,7 @@ class WordAds { /** * Ads parameters. * - * @var null + * @var WordAds_Params */ public $params = null; @@ -269,8 +269,12 @@ public static function is_infinite_scroll() { */ private function insert_adcode() { add_filter( 'wp_resource_hints', array( $this, 'resource_hints' ), 10, 2 ); + + // These 'wp_head' actions add the IPONWEB JavaScript snippets to the page. + // We need to remove them whenever add_action( 'wp_head', array( $this, 'insert_head_meta' ), 20 ); add_action( 'wp_head', array( $this, 'insert_head_iponweb' ), 30 ); + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_filter( 'wordads_ads_txt', array( $this, 'insert_custom_adstxt' ) ); @@ -738,6 +742,12 @@ public function get_ad_snippet( $section_id, $height, $width, $location = '', $c } $loc_id = esc_js( $loc_id ); + + $format = $this->get_wordads_format( (int) $width, (int) $height ); + if ( $format === '' ) { + return ''; + } + return <<
@@ -767,6 +786,34 @@ public function get_ad_snippet( $section_id, $height, $width, $location = '', $c return $this->get_dynamic_ad_snippet( $section_id, $form_factor, $location ); } + /** + * Determine the WordAds format based on the ad dimensions. + * + * @param int $width The width of the ad slot. + * @param int $height The height of the ad slot. + * + * @return string WordAds Format enum. + */ + private function get_wordads_format( int $width, int $height ): string { + if ( $width === 300 && $height === 250 ) { + return 'gutenberg_rectangle'; + } + + if ( $width === 728 && $height === 90 ) { + return 'gutenberg_leaderboard'; + } + + if ( $width === 320 && $height === 50 ) { + return 'gutenberg_mobile_leaderboard'; + } + + if ( $width === 160 && $height === 600 ) { + return 'gutenberg_skyscraper'; + } + + return ''; + } + /** * Returns the dynamic snippet to be inserted into the ad unit * diff --git a/projects/plugins/jetpack/unauth-file-upload.php b/projects/plugins/jetpack/unauth-file-upload.php index 8081d6fd55121..b002aaba4dde1 100644 --- a/projects/plugins/jetpack/unauth-file-upload.php +++ b/projects/plugins/jetpack/unauth-file-upload.php @@ -98,7 +98,7 @@ function handle_file_download() { // Output file content and exit echo $file['content']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Binary file data - exit; + exit( 0 ); } /**