WordPress Ad Widget - Version 2.18.0

Version Description

Download this release

Release Info

Developer broadstreetads
Plugin Icon wp plugin WordPress Ad Widget
Version 2.18.0
Comparing to
See all releases

Code changes from version 2.17.0 to 2.18.0

Files changed (4) hide show
  1. adwidget.php +105 -2
  2. assets/widgets.js +27 -0
  3. readme.txt +7 -7
  4. views/admin.php +4 -3
adwidget.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
Plugin Name: Wordpress Ad Widget
6
Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
7
Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
8
- Version: 2.17.0
9
Author: Broadstreet XPRESS
10
Author URI: http://broadstreetads.com
11
*/
@@ -46,6 +46,7 @@ class AdWidget_Core
46
{
47
register_widget('AdWidget_HTMLWidget');
48
register_widget('AdWidget_ImageWidget');
49
}
50
51
/**
@@ -111,6 +112,16 @@ class AdWidget_Core
111
if( $value !== FALSE ) return $value;
112
return $default;
113
}
114
}
115
116
@@ -206,11 +217,103 @@ class AdWidget_HTMLWidget extends WP_Widget
206
<label for="<?php echo $this->get_field_id('w_adv'); ?>">Advertiser Name</label>
207
<input class="widefat" type="text" id="<?php echo $this->get_field_id('w_adv'); ?>" name="<?php echo $this->get_field_name('w_adv'); ?>" value="<?php echo $instance['w_adv']; ?>" />
208
</p>
209
</div>
210
<?php
211
}
212
}
213
214
/**
215
* This is an optional widget to display GitHub projects
216
*/
@@ -376,7 +479,7 @@ class AdWidget_ImageWidget extends WP_Widget
376
<input type="checkbox" name="<?php echo $this->get_field_name('w_new'); ?>" value="yes" <?php if($instance['w_new'] == 'yes') echo 'checked'; ?> />
377
</p>
378
<p>
379
- <span style="color: green; font-weight: bold;">Tip:</span> If you're using this widget, you might also find <a target="_blank" href="https://information.broadstreetads.com/category/ad-formats/">our special ad formats for sales people and publishers</a> useful.
380
</p>
381
</div>
382
<?php
5
Plugin Name: Wordpress Ad Widget
6
Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
7
Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
8
+ Version: 2.18.0
9
Author: Broadstreet XPRESS
10
Author URI: http://broadstreetads.com
11
*/
46
{
47
register_widget('AdWidget_HTMLWidget');
48
register_widget('AdWidget_ImageWidget');
49
+ register_widget('AdWidget_ParkaveWidget');
50
}
51
52
/**
112
if( $value !== FALSE ) return $value;
113
return $default;
114
}
115
+
116
+ public static function getParkaveWidgetButton($widget, $just_button = false)
117
+ {
118
+ if ($just_button) {
119
+ return '<div style="text-align: center;" id="' . $widget->get_field_id('w_parkave_button') . '"></div><p><a href="https://www.youtube.com/watch?v=QBTH4aF9vJ0&feature=emb_title" target="_blank">Learn more about ParkAve for news and magazine publishers.</a></p>';
120
+ } else {
121
+ return '<div style="background-color: #f7f7f7; border-radius: 4px; padding: 5px 10px; margin-bottom: 10px;"><p><strong>Impress advertising prospects with amazing banner styles.</strong> Click below to use it right here, for free. <a href="https://www.youtube.com/watch?v=QBTH4aF9vJ0&feature=emb_title" target="_blank">Watch a video explainer.</a></p><div style="text-align: center;" id="' . $widget->get_field_id('w_parkave_button') . '"></div><p>After creating a ParkAve ad, be sure to click "Save." below.</p></div>';
122
+ }
123
+
124
+ }
125
}
126
127
217
<label for="<?php echo $this->get_field_id('w_adv'); ?>">Advertiser Name</label>
218
<input class="widefat" type="text" id="<?php echo $this->get_field_id('w_adv'); ?>" name="<?php echo $this->get_field_name('w_adv'); ?>" value="<?php echo $instance['w_adv']; ?>" />
219
</p>
220
+
221
+ <?php echo AdWidget_Core::getParkaveWidgetButton($this) ?>
222
+
223
</div>
224
<?php
225
}
226
}
227
228
+ class AdWidget_ParkaveWidget extends WP_Widget {
229
+ /**
230
+ * Set the widget options
231
+ */
232
+ function __construct()
233
+ {
234
+ $widget_ops = array('classname' => 'AdWidget_ParkaveWidget', 'description' => 'For news and magazine publishers');
235
+ parent::__construct('AdWidget_ParkaveWidget', 'Ad: ParkAve for News and Magazines', $widget_ops);
236
+ }
237
+
238
+
239
+ /**
240
+ * Display the widget on the sidebar
241
+ * @param array $args
242
+ * @param array $instance
243
+ */
244
+ function widget($args, $instance)
245
+ {
246
+ extract($args);
247
+
248
+ echo $before_widget;
249
+
250
+ echo "<div style='text-align: center;'>{$instance['w_adcode']}</div>";
251
+
252
+ echo $after_widget;
253
+ }
254
+
255
+ /**
256
+ * Update the widget info from the admin panel
257
+ * @param array $new_instance
258
+ * @param array $old_instance
259
+ * @return array
260
+ */
261
+ function update($new_instance, $old_instance)
262
+ {
263
+ $instance = $old_instance;
264
+
265
+ $instance['w_adcode'] = $new_instance['w_adcode'];
266
+ $instance['w_adv'] = $new_instance['w_adv'];
267
+
268
+ /* New ad? Upload it to Broadstreet */
269
+ if($instance['w_adcode'] && Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
270
+
271
+ $advertisement_id = false;
272
+ # New ad?
273
+ if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
274
+
275
+ # New advertiser?
276
+ if(!$advertisement_id) {
277
+ $api = Broadstreet_Adwidget_Mini_Utility::getClient();
278
+ $adv = $api->createAdvertiser(Broadstreet_Adwidget_Mini_Utility::getNetworkID(), $instance['w_adv']);
279
+ $instance['bs_adv_id'] = $adv->id;
280
+ }
281
+
282
+ $ad = Broadstreet_Adwidget_Mini_Utility::importHTMLAd(Broadstreet_Adwidget_Mini_Utility::getNetworkID(),
283
+ $instance['bs_adv_id'],
284
+ $instance['w_adcode'],
285
+ $advertisement_id);
286
+
287
+ if(!$advertisement_id) {
288
+ $instance['bs_ad_html'] = $ad->html;
289
+ $instance['bs_ad_id'] = $ad->id;
290
+ $instance['bs_adv_id'] = $adv->id;
291
+ }
292
+ }
293
+
294
+ return $instance;
295
+ }
296
+
297
+ /**
298
+ * Display the widget update form
299
+ * @param array $instance
300
+ */
301
+ function form($instance)
302
+ {
303
+ $defaults = array('w_adcode' => '', 'w_adv' => 'New Advertiser');
304
+ $instance = wp_parse_args((array) $instance, $defaults);
305
+ ?>
306
+ <div class="widget-content">
307
+ <p>
308
+ <label for="<?php echo $this->get_field_id('w_adcode'); ?>">Click the ParkAve button below to fill this box with the appropriate code</label>
309
+ <textarea style="height: 100px;" class="widefat" id="<?php echo $this->get_field_id( 'w_adcode' ); ?>" name="<?php echo $this->get_field_name('w_adcode'); ?>"><?php echo $instance['w_adcode']; ?></textarea>
310
+ </p>
311
+ <?php echo AdWidget_Core::getParkaveWidgetButton($this, true) ?>
312
+ </div>
313
+ <?php
314
+ }
315
+ }
316
+
317
/**
318
* This is an optional widget to display GitHub projects
319
*/
479
<input type="checkbox" name="<?php echo $this->get_field_name('w_new'); ?>" value="yes" <?php if($instance['w_new'] == 'yes') echo 'checked'; ?> />
480
</p>
481
<p>
482
+ <span style="color: green; font-weight: bold;">Tip:</span> If you're using this widget, you might also find the <strong>Ad: ParkAve</strong> widget useful for easy-to-create banner styles.
483
</p>
484
</div>
485
<?php
assets/widgets.js CHANGED
@@ -1,4 +1,31 @@
1
jQuery(function($) {
2
$('.upload-button').live('click', function(e) {
3
window.adcode_id = $(e.target).attr('rel');
4
window.send_to_editor = image_upload_handler;
1
+ jQuery.getScript('https://cdn.getparkave.com/' + 'integration.js');
2
+ jQuery.getScript('https://cdn.getparkave.com/' + 'go-sell.js');
3
+
4
jQuery(function($) {
5
+
6
+ // this ads parkave to the widgets - we need an interval because we
7
+ // need to handle the case of new widgets
8
+ setInterval(function () {
9
+
10
+ $('#widgets-right [id*="adwidget_"] [id*="parkave_button"]').each(function (i, o) {
11
+ if (o.dataset && o.dataset.tracked) return;
12
+ if (o.dataset) o.dataset.tracked = true;
13
+
14
+ var el = o;
15
+ var widget = jQuery(o).parents('.widget-content');
16
+ var txt = widget.find('textarea')[0];
17
+
18
+ ParkAve.button(el, {
19
+ callback: (code) => {
20
+ jQuery(o).parents('form').first().trigger('change');
21
+ },
22
+ codeElement: txt,
23
+ partner: 'adwidget'
24
+ });
25
+ });
26
+
27
+ }, 1000);
28
+
29
$('.upload-button').live('click', function(e) {
30
window.adcode_id = $(e.target).attr('rel');
31
window.send_to_editor = image_upload_handler;
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
Contributors: Broadstreet
3
Tags: wordpress,ad,widget,sidebar,google,tag,code
4
Requires at least: 3.0
5
- Tested up to: 5.1
6
- Stable tag: 2.17.0
7
8
Easily upload ad images and ad code to your sidebar. For those that don't need or
9
want a complicated ad management system.
@@ -13,7 +13,9 @@ want a complicated ad management system.
13
This is the easiest way to place ads in your Wordpress site. Just drag a widget
14
to the sidebar, upload, an ad, and save.
15
16
- Watch a short video demo: http://www.screenr.com/u0t7
17
18
* Extremely intuitive for beginners
19
* No clunky ad management interface
@@ -27,7 +29,7 @@ You will not find an easier way to run ads on your website!
27
28
== Demo ==
29
30
- Watch a short video demo: http://www.screenr.com/u0t7
31
32
== Troubleshooting ==
33
@@ -48,6 +50,4 @@ ads from appearing!
48
Other than that, there aren't any special instructions for installing this plug-in. Once
49
installed, go to Appearance -> Widgets, and look for the "Ad Widget" widgets!
50
51
- You can also go to Settings -> Ad Widget for a video demo on how to use it.
52
-
53
- Also, think about trying [Selfie](http://wordpress.org/plugins/selfie).
2
Contributors: Broadstreet
3
Tags: wordpress,ad,widget,sidebar,google,tag,code
4
Requires at least: 3.0
5
+ Tested up to: 5.3
6
+ Stable tag: 2.18.0
7
8
Easily upload ad images and ad code to your sidebar. For those that don't need or
9
want a complicated ad management system.
13
This is the easiest way to place ads in your Wordpress site. Just drag a widget
14
to the sidebar, upload, an ad, and save.
15
16
+ Watch a short video demo: https://youtu.be/E9CC3ZWOaLU
17
+
18
+ Note: If you have an adblocker installed, it will prevent this widget (and parts of Wordpress) from working properly.
19
20
* Extremely intuitive for beginners
21
* No clunky ad management interface
29
30
== Demo ==
31
32
+ Watch a short video demo: https://youtu.be/E9CC3ZWOaLU
33
34
== Troubleshooting ==
35
50
Other than that, there aren't any special instructions for installing this plug-in. Once
51
installed, go to Appearance -> Widgets, and look for the "Ad Widget" widgets!
52
53
+ You can also go to Settings -> Ad Widget for a video demo on how to use it.
views/admin.php CHANGED
@@ -9,12 +9,13 @@
9
<p>Thank you for using our plugin! This plugin was built by <a href="http://broadstreetads.com">Broadstreet</a>, the
10
company for independent publishers.</p>
11
12
- <p>To put an ad on your website, just go to <a href="widgets.php">the widgets page</a>,
13
and look for:</p>
14
15
<ul>
16
<li><strong>Ad: HTML/Javascript Ad</strong></li>
17
<li><strong>Ad: Image/Banner Ad</strong></li>
18
</ul>
19
20
<p>
@@ -26,14 +27,14 @@ instructions! Send questions to kenny@broadstreetads.com .
26
Here's a short instructional video if you need help:
27
</p>
28
29
- <iframe src="http://www.screenr.com/embed/u0t7" width="550" height="396" frameborder="0"></iframe>
30
31
</div>
32
33
<div>
34
<div class="fb-like" data-href="http://www.facebook.com/broadstreetads" data-send="false" data-layout="box_count" data-width="450" data-show-faces="true"></div>
35
<a href="https://twitter.com/broadstreetads" class="twitter-follow-button" data-show-count="false">Follow @broadstreetads</a>
36
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
37
</div>
38
39
<h2>The Streetlight</h2>
9
<p>Thank you for using our plugin! This plugin was built by <a href="http://broadstreetads.com">Broadstreet</a>, the
10
company for independent publishers.</p>
11
12
+ <p>To put an ad on your website, just go to <a href="widgets.php">the widgets page</a>,
13
and look for:</p>
14
15
<ul>
16
<li><strong>Ad: HTML/Javascript Ad</strong></li>
17
<li><strong>Ad: Image/Banner Ad</strong></li>
18
+ <li><strong>Ad: ParkAve for News and Magazines</strong></li>
19
</ul>
20
21
<p>
27
Here's a short instructional video if you need help:
28
</p>
29
30
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/E9CC3ZWOaLU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
31
32
</div>
33
34
<div>
35
<div class="fb-like" data-href="http://www.facebook.com/broadstreetads" data-send="false" data-layout="box_count" data-width="450" data-show-faces="true"></div>
36
<a href="https://twitter.com/broadstreetads" class="twitter-follow-button" data-show-count="false">Follow @broadstreetads</a>
37
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
38
</div>
39
40
<h2>The Streetlight</h2>