Changeset 1576964
- Timestamp:
- 01/18/2017 02:56:33 AM (8 years ago)
- Location:
- radcontrol/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
radcontrol/trunk/adcontrol.php
r1528300 r1576964 6 6 Description: Harness WordPress.com's advertising partners for your own website. Requires <a href="http://jetpack.me/" target="_blank">Jetpack</a> to be installed and connected. 7 7 Author: Automattic 8 Version: 1. 1.38 Version: 1. 9 9 Author URI: http://automattic.com 10 10 Text Domain: adcontrol … … 28 28 */ 29 29 30 define( 'ADCONTROL_VERSION', '1. 1.3' );30 define( 'ADCONTROL_VERSION', '1.' ); 31 31 define( 'ADCONTROL_ROOT', dirname( __FILE__ ) ); 32 32 define( 'ADCONTROL_BASENAME', plugin_basename( __FILE__ ) ); … … 232 232 } 233 233 234 return $content . $this->get_ad( 'belowpost' ); 234 $ad_type = $this->option( 'wordads_house', true ) ? 'house' : 'iponweb'; 235 return $content . $this->get_ad( 'belowpost', $ad_type ); 235 236 } 236 237 … … 254 255 255 256 if ( ! $this->params->mobile_device || $this->option( 'leaderboard_mobile', true ) ) { 256 echo $this->get_ad( 'top' ); 257 $ad_type = $this->option( 'wordads_house', true ) ? 'house' : 'iponweb'; 258 echo $this->get_ad( 'top', $ad_type ); 257 259 } 258 260 } … … 285 287 </script> 286 288 HTML; 287 } 288 289 $about = __( 'About these ads', 'adcontrol' ); 289 } else if ( 'house' == $type ) { 290 $width = 300; 291 $height = 250; 292 $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; 293 if ( 'top' == $spot && ! $this->params->mobile_device ) { 294 $width = 728; 295 $height = 90; 296 $ad_url .= 'leaderboard.png'; 297 } else { 298 $ad_url .= 'mrec.png'; 299 } 300 301 $snippet = <<<HTML 302 <a href="https://wordpress.com/create/" target="_blank"> 303 <img src="$ad_url" alt="WordPress.com: Grow Your Business" width="$width" height="$height" /> 304 </a> 305 HTML; 306 } 307 308 $about = __( 'Advertisements', 'adcontrol' ); 290 309 return <<<HTML 291 310 <div class="wpcnt"> -
radcontrol/trunk/php/admin.php
r1373404 r1576964 13 13 'wordads_approved', 14 14 'wordads_active', 15 15 16 ); 16 17 private $active_tab = 'adcontrol_settings'; … … 79 80 '<span style="color:green;">Yes</span>' : 80 81 '<span style="color:red;">No</span>'; 82 81 83 82 84 $type = $this->get_option( 'tos' ) && $this->get_option( 'wordads_approved' ) ? … … 86 88 echo <<<HTML 87 89 <div class="notice $type is-dismissible"> 88 <p>TOS: $tos | Status: $status </p>90 <p>TOS: $tos | Status: $status</p> 89 91 <pre>$response</pre> 90 92 </div> -
radcontrol/trunk/php/api.php
r1339079 r1576964 65 65 self::$wordads_status = array( 66 66 'approved' => true, 67 'active' => true 67 'active' => true, 68 'house' => true, 68 69 ); 69 70 … … 80 81 self::$wordads_status = array( 81 82 'approved' => $body->approved, 82 'active' => $body->active 83 'active' => $body->active, 84 'house' => $body->house, 83 85 ); 84 86 … … 97 99 } 98 100 99 return self::$wordads_status['approved'] ;101 return self::$wordads_status['approved']; 100 102 } 101 103 … … 111 113 } 112 114 113 return self::$wordads_status['active']; 115 return self::$wordads_status['active'] ? '1' : '0'; 116 } 117 118 /** 119 * Returns status of WordAds house ads. 120 * @return boolean true if WP.com house ads should be shown 121 * 122 * @since 1.2 123 */ 124 public static function is_wordads_house() { 125 if ( is_null( self::$wordads_status ) ) { 126 self::get_wordads_status(); 127 } 128 129 return self::$wordads_status['house'] ? '1' : '0'; 114 130 } 115 131 … … 125 141 $options['wordads_approved'] = self::is_wordads_approved(); 126 142 $options['wordads_active'] = self::is_wordads_active(); 143 127 144 update_option( 'adcontrol_settings', $options ); 128 145 } -
radcontrol/trunk/php/widgets.php
r1528300 r1576964 25 25 } 26 26 27 $about = __( 'About these ads', 'adcontrol' ); 27 if ( ! isset( $instance['unit'] ) ) { 28 $instance['unit'] = 'mrec'; 29 } 30 31 $about = __( 'Advertisements', 'adcontrol' ); 28 32 $section_id = 0 === $adcontrol->params->blog_id ? ADCONTROL_API_TEST_ID : $adcontrol->params->blog_id . '3'; 29 33 $width = AdControl::$ad_tag_ids[$instance['unit']]['width']; 30 34 $height = AdControl::$ad_tag_ids[$instance['unit']]['height']; 31 $data_tags = ( $adcontrol->params->cloudflare ) ? ' data-cfasync="false"' : ''; 35 36 $snippet = ''; 37 if ( $adcontrol->option( 'wordads_house', true ) ) { 38 $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; 39 if ( 'leaderboard' == $instance['unit'] && ! $this->params->mobile_device ) { 40 $ad_url .= 'leaderboard.png'; 41 } else if ( 'wideskyscraper' == $instance['unit'] ) { 42 $ad_url .= 'widesky.png'; 43 } else { 44 $ad_url .= 'mrec.png'; 45 } 46 47 $snippet = <<<HTML 48 <a href="https://wordpress.com/create/" target="_blank"> 49 <img src="$ad_url" alt="WordPress.com: Grow Your Business" width="$width" height="$height" /> 50 </a> 51 HTML; 52 } else { 53 $section_id = 0 === $adcontrol->params->blog_id ? ADCONTROL_API_TEST_ID : $adcontrol->params->blog_id . '3'; 54 $data_tags = ( $adcontrol->params->cloudflare ) ? ' data-cfasync="false"' : ''; 55 $snippet = <<<HTML 56 <script$data_tags type='text/javascript'> 57 (function(g){g.__ATA.initAd({sectionId:$section_id, width:$width, height:$height});})(window); 58 </script> 59 HTML; 60 } 61 32 62 echo <<< HTML 33 63 <div class="wpcnt"> … … 35 65 <a class="wpa-about" href="https://en.wordpress.com/about-these-ads/" rel="nofollow">$about</a> 36 66 <div class="u {$instance['unit']}"> 37 <script$data_tags type='text/javascript'> 38 (function(g){g.__ATA.initAd({sectionId:$section_id, width:$width, height:$height});})(window); 39 </script> 67 $snippet 40 68 </div> 41 69 </div> -
radcontrol/trunk/readme.txt
r1528300 r1576964 3 3 Tags: advertising, ad codes, ads 4 4 Requires at least: 3.4 5 Tested up to: 4.7 6 Stable tag: 1. 1.35 Tested up to: 4.7 6 Stable tag: 1. 7 7 8 8 Harness WordPress.com's advertising partners for your own website. … … 36 36 == Changelog == 37 37 38 39 40 41 42 43 38 44 = 1.1.3 = 45 39 46 * Changed the bulk of the JavaScript in the header from being inline to an external JavaScript. 40 47
Note: See TracChangeset
for help on using the changeset viewer.