From 6166678aa0c289e1cb5acd6cace0bdc2f3fed1c6 Mon Sep 17 00:00:00 2001 From: Derek Springer Date: Thu, 23 Feb 2017 10:29:48 -0800 Subject: [PATCH] Ads: Updated House Ads & "Advertisements" Notice (#6471) * Removed link from "Advertisements" notice It was generating too much spam and we have better happiness options now. * Updated house ads to new HTML5 unit --- modules/wordads/css/style.css | 5 --- modules/wordads/php/widgets.php | 16 +++------- modules/wordads/wordads.php | 55 +++++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/modules/wordads/css/style.css b/modules/wordads/css/style.css index a77ec09c2ad9c..687334d68431e 100644 --- a/modules/wordads/css/style.css +++ b/modules/wordads/css/style.css @@ -44,11 +44,6 @@ box-shadow: none !important; } -.wpa-about:hover, .wa_infobox a:hover { - text-decoration: underline !important; /* !important necessary, since themes override this routinely */ - color: #444; -} - /* ad unit wrapper */ .wpa .u>div { /* @todo: deprecate wpdvert */ display: block; diff --git a/modules/wordads/php/widgets.php b/modules/wordads/php/widgets.php index dbe2301ec2bcc..c7beccac101ee 100644 --- a/modules/wordads/php/widgets.php +++ b/modules/wordads/php/widgets.php @@ -37,20 +37,14 @@ public function widget( $args, $instance ) { $snippet = ''; if ( $wordads->option( 'wordads_house', true ) ) { - $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; + $unit = 'mrec'; if ( 'leaderboard' == $instance['unit'] && ! $this->params->mobile_device ) { - $ad_url .= 'leaderboard.png'; + $unit = 'leaderboard'; } else if ( 'wideskyscraper' == $instance['unit'] ) { - $ad_url .= 'widesky.png'; - } else { - $ad_url .= 'mrec.png'; + $unit = 'widesky'; } - $snippet = << - WordPress.com: Grow Your Business - -HTML; + $snippet = $wordads->get_house_ad( $unit ); } else { $section_id = 0 === $wordads->params->blog_id ? WORDADS_API_TEST_ID : $wordads->params->blog_id . '3'; $data_tags = ( $wordads->params->cloudflare ) ? ' data-cfasync="false"' : ''; @@ -64,7 +58,7 @@ public function widget( $args, $instance ) { echo <<< HTML
- $about + $about
$snippet
diff --git a/modules/wordads/wordads.php b/modules/wordads/wordads.php index 4c59d1a57f078..a528fdad4fd94 100644 --- a/modules/wordads/wordads.php +++ b/modules/wordads/wordads.php @@ -302,22 +302,8 @@ function get_ad( $spot, $type = 'iponweb' ) { HTML; } else if ( 'house' == $type ) { - $width = 300; - $height = 250; - $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; - if ( 'top' == $spot && ! $this->params->mobile_device ) { - $width = 728; - $height = 90; - $ad_url .= 'leaderboard.png'; - } else { - $ad_url .= 'mrec.png'; - } - - $snippet = << - WordPress.com: Grow Your Business - -HTML; + $leaderboard = 'top' == $spot && ! $this->params->mobile_device; + $snippet = $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' ); } $header = 'top' == $spot ? 'wpcnt-header' : ''; @@ -325,7 +311,7 @@ function get_ad( $spot, $type = 'iponweb' ) { return <<
- $about + $about
$snippet
@@ -344,6 +330,41 @@ public function should_bail() { return ! $this->option( 'wordads_approved' ); } + /** + * Returns markup for HTML5 house ad base on unit + * @param string $unit mrec, widesky, or leaderboard + * @return string markup for HTML5 house ad + * + * @since 4.7.0 + */ + public function get_house_ad( $unit = 'mrec' ) { + if ( ! in_array( $unit, array( 'mrec', 'widesky', 'leaderboard' ) ) ) { + $unit = 'mrec'; + } + + $width = 300; + $height = 250; + if ( 'widesky' == $unit ) { + $width = 160; + $height = 600; + } else if ( 'leaderboard' == $unit ) { + $width = 728; + $height = 90; + } + + return << + +HTML; + } + /** * Activation hook actions *