WordPress Ad Widget - Version 2.2.0

Version Description

Download this release

Release Info

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

Code changes from version 2.1.6 to 2.2.0

adwidget.php CHANGED
@@ -3,11 +3,13 @@
3
Plugin Name: Wordpress Ad Widget
4
Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
5
Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
6
- Version: 2.1.6
7
Author: Broadstreet Ads
8
Author URI: http://broadstreetads.com
9
*/
10
11
add_action('admin_init', array('AdWidget_Core', 'registerScripts'));
12
add_action('widgets_init', array('AdWidget_Core', 'registerWidgets'));
13
add_action('admin_menu', array('AdWidget_Core', 'registerAdmin'));
@@ -18,7 +20,7 @@ add_action('admin_menu', array('AdWidget_Core', 'registerAdmin'));
18
class AdWidget_Core
19
{
20
CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
21
- CONST VERSION = '2.1.6';
22
23
/**
24
* The callback used to register the scripts
@@ -66,6 +68,13 @@ class AdWidget_Core
66
static function adminMenuCallback()
67
{
68
self::sendInstallReportIfNew();
69
include dirname(__FILE__) . '/views/admin.php';
70
}
71
@@ -192,7 +201,34 @@ class AdWidget_HTMLWidget extends WP_Widget
192
{
193
$instance = $old_instance;
194
195
- $instance['w_adcode'] = $new_instance['w_adcode'];
196
197
return $instance;
198
}
@@ -204,7 +240,7 @@ class AdWidget_HTMLWidget extends WP_Widget
204
function form($instance)
205
{
206
207
- $defaults = array('w_adcode' => '');
208
$instance = wp_parse_args((array) $instance, $defaults);
209
?>
210
<div class="widget-content">
@@ -212,6 +248,10 @@ class AdWidget_HTMLWidget extends WP_Widget
212
<p>
213
<label for="<?php echo $this->get_field_id('w_adcode'); ?>">Ad Code</label>
214
<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>
215
</p>
216
</div>
217
<?php
@@ -244,10 +284,15 @@ class AdWidget_ImageWidget extends WP_Widget
244
$link = @$instance['w_link'];
245
$img = @$instance['w_img'];
246
$resize = @$instance['w_resize'];
247
248
if($resize == 'yes')
249
{
250
- $resize = "style='width: 100%;'";
251
}
252
253
echo $before_widget;
@@ -257,8 +302,16 @@ class AdWidget_ImageWidget extends WP_Widget
257
$img = AdWidget_Core::getBaseURL() . 'assets/sample-ad.png';
258
$link = 'http://adsofthefuture.com';
259
}
260
-
261
- echo "<a target='_blank' href='$link' alt='Ad'><img $resize src='$img' alt='Ad' /></a>";
262
263
echo $after_widget;
264
}
@@ -272,10 +325,41 @@ class AdWidget_ImageWidget extends WP_Widget
272
function update($new_instance, $old_instance)
273
{
274
$instance = $old_instance;
275
276
$instance['w_link'] = $new_instance['w_link'];
277
$instance['w_img'] = $new_instance['w_img'];
278
- $instance['w_resize'] = $new_instance['w_resize'];
279
280
return $instance;
281
}
@@ -289,23 +373,24 @@ class AdWidget_ImageWidget extends WP_Widget
289
$link_id = $this->get_field_id('w_link');
290
$img_id = $this->get_field_id('w_img');
291
292
- $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_resize' => 'no');
293
294
$instance = wp_parse_args((array) $instance, $defaults);
295
296
- $img = $instance['w_img'];
297
$link = $instance['w_link'];
298
-
299
?>
300
<div class="widget-content">
301
<p style="text-align: center;" class="bs-proof">
302
<?php if($instance['w_img']): ?>
303
Your ad is ready.
304
<br/><br/><strong>Scaled Visual:</strong><br/>
305
- <div class="bs-proof"><img style="width:100%;" src="<?php echo $instance['w_img'] ?>" alt="Ad" /></div>
306
- <?php else: ?>
307
- <a href="#" class="upload-button" rel="<?php echo $img_id ?>">Click here to upload a new image.</a> You can also paste in an image URL below.
308
<?php endif; ?>
309
</p>
310
<input class="widefat tag" placeholder="Image URL" type="text" id="<?php echo $img_id; ?>" name="<?php echo $this->get_field_name('w_img'); ?>" value="<?php echo htmlentities($instance['w_img']); ?>" />
311
<br/><br/>
@@ -313,18 +398,51 @@ class AdWidget_ImageWidget extends WP_Widget
313
<label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
314
<input class="widefat" type="text" id="<?php echo $this->get_field_id('w_link'); ?>" name="<?php echo $this->get_field_name('w_link'); ?>" value="<?php echo $instance['w_link']; ?>" />
315
</p>
316
<p>
317
<label for="<?php echo $this->get_field_id('w_resize'); ?>">Auto Resize to Max Width? </label>
318
<input type="checkbox" name="<?php echo $this->get_field_name('w_resize'); ?>" value="yes" <?php if($instance['w_resize'] == 'yes') echo 'checked'; ?> />
319
</p>
320
<p>
321
- When you're ready for a more powerful adserver, <a target="_blank" href="http://broadstreetads.com/ad-platform/adserving/">visit Broadstreet</a>.
322
</p>
323
</div>
324
<?php
325
}
326
}
327
-
328
-
329
-
330
-
3
Plugin Name: Wordpress Ad Widget
4
Plugin URI: https://github.com/broadstreetads/wordpress-ad-widget
5
Description: The easiest way to place ads in your Wordpress sidebar. Go to Settings -> Ad Widget
6
+ Version: 2.2.0
7
Author: Broadstreet Ads
8
Author URI: http://broadstreetads.com
9
*/
10
11
+ require_once 'lib/Utility.php';
12
+
13
add_action('admin_init', array('AdWidget_Core', 'registerScripts'));
14
add_action('widgets_init', array('AdWidget_Core', 'registerWidgets'));
15
add_action('admin_menu', array('AdWidget_Core', 'registerAdmin'));
20
class AdWidget_Core
21
{
22
CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
23
+ CONST VERSION = '2.2.0';
24
25
/**
26
* The callback used to register the scripts
68
static function adminMenuCallback()
69
{
70
self::sendInstallReportIfNew();
71
+
72
+ if(isset($_POST['cancel']))
73
+ Broadstreet_Mini_Utility::hasAdserving(false);
74
+
75
+ if(isset($_POST['subscribe']))
76
+ Broadstreet_Mini_Utility::hasAdserving(true);
77
+
78
include dirname(__FILE__) . '/views/admin.php';
79
}
80
201
{
202
$instance = $old_instance;
203
204
+ $instance['w_adcode'] = $new_instance['w_adcode'];
205
+ $instance['w_adv'] = $new_instance['w_adv'];
206
+
207
+ /* New ad? Upload it to Broadstreet */
208
+ if($instance['w_adcode'] && Broadstreet_Mini_Utility::hasAdserving()) {
209
+
210
+ $advertisement_id = false;
211
+ # New ad?
212
+ if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
213
+
214
+ # New advertiser?
215
+ if(!$advertisement_id) {
216
+ $api = Broadstreet_Mini_Utility::getClient();
217
+ $adv = $api->createAdvertiser(Broadstreet_Mini_Utility::getNetworkID(), $instance['w_adv']);
218
+ $instance['bs_adv_id'] = $adv->id;
219
+ }
220
+
221
+ $ad = Broadstreet_Mini_Utility::importHTMLAd(Broadstreet_Mini_Utility::getNetworkID(),
222
+ $instance['bs_adv_id'],
223
+ $instance['w_adcode'],
224
+ $advertisement_id);
225
+
226
+ if(!$advertisement_id) {
227
+ $instance['bs_ad_html'] = $ad->html;
228
+ $instance['bs_ad_id'] = $ad->id;
229
+ $instance['bs_adv_id'] = $adv->id;
230
+ }
231
+ }
232
233
return $instance;
234
}
240
function form($instance)
241
{
242
243
+ $defaults = array('w_adcode' => '', 'w_adv' => 'New Advertiser');
244
$instance = wp_parse_args((array) $instance, $defaults);
245
?>
246
<div class="widget-content">
248
<p>
249
<label for="<?php echo $this->get_field_id('w_adcode'); ?>">Ad Code</label>
250
<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>
251
+ </p>
252
+ <p>
253
+ <label for="<?php echo $this->get_field_id('w_adv'); ?>">Advertiser Name</label>
254
+ <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']; ?>" />
255
</p>
256
</div>
257
<?php
284
$link = @$instance['w_link'];
285
$img = @$instance['w_img'];
286
$resize = @$instance['w_resize'];
287
+ $id = rand(1, 100000);
288
289
if($resize == 'yes')
290
{
291
+ $resize_s = "style='width: 100%;'";
292
+ }
293
+ else
294
+ {
295
+ $resize_s = '';
296
}
297
298
echo $before_widget;
302
$img = AdWidget_Core::getBaseURL() . 'assets/sample-ad.png';
303
$link = 'http://adsofthefuture.com';
304
}
305
+
306
+ if(Broadstreet_Mini_Utility::hasAdserving() && is_numeric($instance['bs_ad_id']))
307
+ {
308
+ if($resize == 'yes') echo '<style type="text/css">.adwidget-id'.$id.' img { width: 100% !important; height: auto !important; }</style>';
309
+ echo "<span class='adwidget-id$id'>{$instance['bs_ad_html']}</span>";
310
+ }
311
+ else
312
+ {
313
+ echo "<a target='_blank' href='$link' alt='Ad'><img $resize_s src='$img' alt='Ad' /></a>";
314
+ }
315
316
echo $after_widget;
317
}
325
function update($new_instance, $old_instance)
326
{
327
$instance = $old_instance;
328
+
329
+ $changed = ($instance['w_img'] != $new_instance['w_img']
330
+ || $instance['w_link'] !== $new_instance['w_link']);
331
332
$instance['w_link'] = $new_instance['w_link'];
333
$instance['w_img'] = $new_instance['w_img'];
334
+ $instance['w_resize'] = @$new_instance['w_resize'];
335
+ $instance['w_adv'] = $new_instance['w_adv'];
336
+
337
+ /* New ad? Upload it to Broadstreet */
338
+ if($instance['w_img'] && $changed && Broadstreet_Mini_Utility::hasAdserving()) {
339
+
340
+ $advertisement_id = false;
341
+ # New ad?
342
+ if(is_numeric(@$instance['bs_ad_id'])) $advertisement_id = $instance['bs_ad_id'];
343
+
344
+ # New advertiser?
345
+ if(!$advertisement_id) {
346
+ $api = Broadstreet_Mini_Utility::getClient();
347
+ $adv = $api->createAdvertiser(Broadstreet_Mini_Utility::getNetworkID(), $instance['w_adv']);
348
+ $instance['bs_adv_id'] = $adv->id;
349
+ }
350
+
351
+ $ad = Broadstreet_Mini_Utility::importImageAd(Broadstreet_Mini_Utility::getNetworkID(),
352
+ $instance['bs_adv_id'],
353
+ $instance['w_img'],
354
+ $instance['w_link'],
355
+ $advertisement_id);
356
+
357
+ if(!$advertisement_id) {
358
+ $instance['bs_ad_html'] = $ad->html;
359
+ $instance['bs_ad_id'] = $ad->id;
360
+ $instance['bs_adv_id'] = $adv->id;
361
+ }
362
+ }
363
364
return $instance;
365
}
373
$link_id = $this->get_field_id('w_link');
374
$img_id = $this->get_field_id('w_img');
375
376
+ $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_adv' => 'New Advertiser', 'w_resize' => 'no');
377
378
$instance = wp_parse_args((array) $instance, $defaults);
379
380
+ $img = $instance['w_img'];
381
$link = $instance['w_link'];
382
+ $adv = $instance['w_adv'];
383
+
384
?>
385
<div class="widget-content">
386
<p style="text-align: center;" class="bs-proof">
387
<?php if($instance['w_img']): ?>
388
Your ad is ready.
389
<br/><br/><strong>Scaled Visual:</strong><br/>
390
+ <div class="bs-proof"><img style="width:100%;" src="<?php echo $instance['w_img'] ?>" alt="Ad" /></div><br/>
391
<?php endif; ?>
392
+ <a href="#" class="upload-button" rel="<?php echo $img_id ?>">Click here to upload a new image.</a> You can also paste in an image URL below.
393
+
394
</p>
395
<input class="widefat tag" placeholder="Image URL" type="text" id="<?php echo $img_id; ?>" name="<?php echo $this->get_field_name('w_img'); ?>" value="<?php echo htmlentities($instance['w_img']); ?>" />
396
<br/><br/>
398
<label for="<?php echo $this->get_field_id('w_link'); ?>">Ad Click Destination:</label><br/>
399
<input class="widefat" type="text" id="<?php echo $this->get_field_id('w_link'); ?>" name="<?php echo $this->get_field_name('w_link'); ?>" value="<?php echo $instance['w_link']; ?>" />
400
</p>
401
+ <p>
402
+ <label for="<?php echo $this->get_field_id('w_adv'); ?>">Advertiser Name:</label><br/>
403
+ <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']; ?>" />
404
+ </p>
405
<p>
406
<label for="<?php echo $this->get_field_id('w_resize'); ?>">Auto Resize to Max Width? </label>
407
<input type="checkbox" name="<?php echo $this->get_field_name('w_resize'); ?>" value="yes" <?php if($instance['w_resize'] == 'yes') echo 'checked'; ?> />
408
</p>
409
+ <?php if(!Broadstreet_Mini_Utility::hasAdserving()): ?>
410
+ <p>
411
+ <span style="color: green; font-weight: bold;">New!</span> When you're ready for a more powerful adserver with click reporting <a target="_blank" href="#" onclick="broadstreet_upgrade(); return false;">click here</a>.
412
+ <script language="javascript">
413
+ if(!window.broadstreet_upgrade)
414
+ {
415
+ function broadstreet_upgrade()
416
+ {
417
+ window.send_to_editor = function(html) {
418
+ tb_remove();
419
+ alert('Save any unsaved widgets and refresh this page to see new upgraded options');
420
+ };
421
+
422
+ tb_show('Broadstreet', '<?php echo bs_get_base_url('views/modal/') ?>' + '?fake=fake&width=650&height=580&TB_iframe=true');
423
+ }
424
+ }
425
+ </script>
426
+ </p>
427
+ <?php elseif(isset($instance['bs_ad_id'])): ?>
428
<p>
429
+ Reporting: <a target="_blank" href="#" onclick="broadstreet_reports(); return false;">View stats for clicks and views</a>
430
+ <script language="javascript">
431
+ if(!window.broadstreet_reports)
432
+ {
433
+ function broadstreet_reports()
434
+ {
435
+ window.send_to_editor = function(html) {
436
+ tb_remove();
437
+ };
438
+
439
+ tb_show('Broadstreet', '<?php echo bs_get_base_url('views/modal/?step=reports&adv_id=' . @$instance['bs_adv_id'] . '&ad_id=' . @$instance['bs_ad_id']) ?>' + '&width=650&height=580&TB_iframe=true');
440
+ }
441
+ }
442
+ </script>
443
</p>
444
+ <?php endif; ?>
445
</div>
446
<?php
447
}
448
}
lib/Broadstreet.php ADDED
@@ -0,0 +1,456 @@
1
+ <?php
2
+ /**
3
+ * This is the PHP client for Broadstreet
4
+ * @link http://broadstreetads.com
5
+ * @author Broadstreet Ads <labs@broadstreetads.com>
6
+ */
7
+
8
+ if(!class_exists('Broadstreet')):
9
+
10
+ /**
11
+ * This is the PHP client and class for Broadstreet
12
+ * It requires cURL
13
+ */
14
+ class Broadstreet
15
+ {
16
+ const API_VERSION = '0';
17
+
18
+ /**
19
+ * The API Key used for auth
20
+ * @var string
21
+ */
22
+ protected $accessToken = null;
23
+
24
+ /**
25
+ * The hostname to point at
26
+ * @var string
27
+ */
28
+ protected $host = 'api.broadstreetads.com';
29
+
30
+ /**
31
+ * Use SSL? You should.
32
+ * @var bool
33
+ */
34
+ protected $use_ssl = true;
35
+
36
+ /**
37
+ * The constructor
38
+ * @param string $access_token A user's access token
39
+ * @param string $host The API endpoint host. Optional. Defaults to
40
+ * api.broadstreetads.com
41
+ */
42
+ public function __construct($access_token = null, $host = null, $secure = true)
43
+ {
44
+ if($host !== null)
45
+ {
46
+ $this->host = $host;
47
+ }
48
+
49
+ $this->accessToken = $access_token;
50
+ $this->use_ssl = $secure;
51
+
52
+ /* Define cURL constants if needed */
53
+ if(!defined('CURLOPT_POST'))
54
+ {
55
+ define('CURLOPT_POST', 47);
56
+ define('CURLOPT_POSTFIELDS', 10015);
57
+ define('CURLOPT_RETURNTRANSFER', 19913);
58
+ define('CURLOPT_CUSTOMREQUEST', 10036);
59
+ define('CURLINFO_HTTP_CODE', 2097154);
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Magically get back business data based off a seed URL
65
+ * @param string $seed_url
66
+ * @param int $network_id
67
+ */
68
+ public function magicImport($seed_url, $network_id)
69
+ {
70
+ return $this->_get("/networks/$network_id/import", array(), array('lookup' => $seed_url))->body;
71
+ }
72
+
73
+ /**
74
+ * Create an advertiser
75
+ * @param string $name The name of the advertiser
76
+ * @return mixed
77
+ */
78
+ public function createAdvertiser($network_id, $name)
79
+ {
80
+ return $this->_post("/networks/$network_id/advertisers", array('name' => $name))->body->advertiser;
81
+ }
82
+
83
+ /**
84
+ * Create an advertisement
85
+ * @param string $name The name of the advertisement
86
+ * @param string $type The type of advertisement
87
+ * @return mixed
88
+ */
89
+ public function createAdvertisement($network_id, $advertiser_id, $name, $type, $options = array())
90
+ {
91
+ $params = array('name' => $name, 'type' => $type) + $options;
92
+
93
+ return $this->_post("/networks/$network_id/advertisers/$advertiser_id/advertisements", $params)->body->advertisement;
94
+ }
95
+
96
+ /**
97
+ * Create a network
98
+ * @param string $name The name of the network
99
+ * @param array $options An array of options
100
+ */
101
+ public function createNetwork($name, $options = array())
102
+ {
103
+ $options['name'] = $name;
104
+ return $this->_post("/networks", $options)->body->network;
105
+ }
106
+
107
+ /**
108
+ * Create a basic user
109
+ * @param string $email
110
+ */
111
+ public function createUser($email)
112
+ {
113
+ return $this->_post($email, $data);
114
+ }
115
+
116
+ /**
117
+ * Create a proof
118
+ * @param array $params
119
+ */
120
+ public function createProof($params)
121
+ {
122
+ return $this->_post("/advertisements/proof", $params)->body->proof;
123
+ }
124
+
125
+ /**
126
+ * Log in to the API, get an access token back
127
+ * @param string $username
128
+ * @param string $password
129
+ */
130
+ public function login($email, $password)
131
+ {
132
+ $params = array('email' => $email, 'password' => $password);
133
+ $response = $this->_post("/sessions", $params)->body->user;
134
+
135
+ $this->accessToken = $response->access_token;
136
+
137
+ # Store access token
138
+ return $response;
139
+ }
140
+
141
+ /**
142
+ * Register a new user
143
+ * @param string $username
144
+ * @param string $password
145
+ */
146
+ public function register($email)
147
+ {
148
+ $params = array('email' => $email);
149
+ $response = $this->_post("/users", $params)->body->user;
150
+
151
+ $this->accessToken = $response->access_token;
152
+
153
+ # Store access token
154
+ return $response;
155
+ }
156
+
157
+ /**
158
+ * Get a list of fonts supported by Broadstreet
159
+ */
160
+ public function getFonts()
161
+ {
162
+ return $this->_get("/fonts")->body->fonts;
163
+ }
164
+
165
+ /**
166
+ * Get base account information for a network, including whether a card is
167
+ * on file, the cost of an import (in cents), etc
168
+ * @param int $network_id
169
+ */
170
+ public function getNetwork($network_id)
171
+ {
172
+ return $this->_get("/networks/$network_id")->body->network;
173
+ }
174
+
175
+ /**
176
+ * Update an advertisement
177
+ * @param string $name The name of the advertisement
178
+ * @param string $type The type of advertisement
179
+ * @return mixed
180
+ */
181
+ public function updateAdvertisement($network_id, $advertiser_id, $advertisement_id, $params = array())
182
+ {
183
+ return $this->_put("/networks/$network_id/advertisers/$advertiser_id/advertisements/$advertisement_id", $params)->body->advertisement;
184
+ }
185
+
186
+ /**
187
+ * Get a list of advertisers this token has access to
188
+ */
189
+ public function getAdvertisers($network_id)
190
+ {
191
+ return $this->_get("/networks/$network_id/advertisers")->body->advertisers;
192
+ }
193
+
194
+ /**
195
+ * Get information about a given advertisement
196
+ * @param int $network_id
197
+ * @param int $advertiser_id
198
+ * @param int $advertisement_id
199
+ * @return object
200
+ */
201
+ public function getAdvertisement($network_id, $advertiser_id, $advertisement_id)
202
+ {
203
+ return $this->_get("/networks/$network_id/advertisers/$advertiser_id/advertisements/$advertisement_id")
204
+ ->body->advertisement;
205
+ }
206
+
207
+ /**
208
+ * Get information about a given advertisement source
209
+ * @param int $network_id
210
+ * @param int $advertiser_id
211
+ * @param int $advertisement_id
212
+ * @return object
213
+ */
214
+ public function getAdvertisementSource($network_id, $advertiser_id, $advertisement_id)
215
+ {
216
+ return $this->_get("/networks/$network_id/advertisers/$advertiser_id/advertisements/$advertisement_id/source")
217
+ ->body->source;
218
+ }
219
+
220
+ /**
221
+ * Get a list of networks this token has access to
222
+ * @return array
223
+ */
224
+ public function getNetworks()
225
+ {
226
+ return $this->_get('/networks')->body->networks;
227
+ }
228
+
229
+ /**
230
+ * Get a report for a given advertisement for the last x days
231
+ * @param type $network_id
232
+ * @param type $advertiser_id
233
+ * @param type $advertisement_id
234
+ * @param type $start_date
235
+ * @param type $end_date
236
+ * @return type
237
+ */
238
+ public function getAdvertisementReport($network_id, $advertiser_id, $advertisement_id, $start_date = false, $end_date = false)
239
+ {
240
+ return $this->_get("/networks/$network_id/advertisers/$advertiser_id/advertisements/$advertisement_id/records", array(), array (
241
+ 'start_date' => $start_date,
242
+ 'end_date' => $end_date
243
+ ))->body->records;
244
+ }
245
+
246
+ /**
247
+ * Get a list of zones under a network
248
+ * @return object
249
+ */
250
+ public function getNetworkZones($network_id)
251
+ {
252
+ return $this->_get("/networks/$network_id/zones")->body->zones;
253
+ }
254
+
255
+ /**
256
+ * The the update source of an advertisement
257
+ * @param int $network_id
258
+ * @param int $advertiser_id
259
+ * @param int $advertisement_id
260
+ * @param string $type
261
+ * @param array $options
262
+ * @return object
263
+ */
264
+ public function setAdvertisementSource($network_id, $advertiser_id, $advertisement_id, $type, $options = array())
265
+ {
266
+ $params = array('type' => $type) + $options;
267
+
268
+ return $this->_post("/networks/$network_id/advertisers/$advertiser_id/advertisements/$advertisement_id/source", $params)
269
+ ->body->advertisement;
270
+ }
271
+
272
+ /**
273
+ * Gets a response from the server
274
+ * @param string $uri
275
+ * @param array $options
276
+ * @param array $query_args
277
+ * @return type
278
+ * @throws Broadstreet_DependencyException
279
+ * @throws Broadstreet_AuthException
280
+ */
281
+ protected function _get($uri, $options = array(), $query_args = array())
282
+ {
283
+ $url = $this->_buildRequestURL($uri, $query_args);
284
+
285
+ # If the Wordpress HTTP library is loaded, use it
286
+ if(function_exists('wp_remote_post'))
287
+ {
288
+ list($body, $status) = $this->_wpGet($url, $options);
289
+ }
290
+ else
291
+ {
292
+ # Fallback to cURL
293
+ if(!function_exists('curl_exec'))
294
+ {
295
+ throw new Broadstreet_DependencyException("The cURL module must be installed");
296
+ }
297
+
298
+ list($body, $status) = $this->_curlGet($url, $options);
299
+ }
300
+
301
+ if($status == '403')
302
+ {
303
+ throw new Broadstreet_ServerException("Broadstreet API Auth Denied (HTTP 403)", @json_decode($body));
304
+ }
305
+
306
+ if($status == '500')
307
+ {
308
+ throw new Broadstreet_ServerException("Broadstreet API had a 500 error");
309
+ }
310
+
311
+ if($status[0] != '2')
312
+ {
313
+ throw new Broadstreet_ServerException("Server threw HTTP $status for call to $uri with cURL params " . print_r($options, true) . "; Response: " . $body, @json_decode($body));
314
+ }
315
+
316
+ return (object)(array('url' => $url, 'body' => @json_decode($body), 'status' => $status));
317
+ }
318
+
319
+ /**
320
+ * Issue a network request using the built-in Wordpress libraries
321
+ * Intended for use within Wordpress for extra portability
322
+ * @param string $url
323
+ * @param array $options cURL options. Limited support
324
+ * @return array(body, status_code)
325
+ */
326
+ protected function _wpGet($url, $options = array())
327
+ {
328
+ $params = array (
329
+ 'method' => 'GET',
330
+ 'timeout' => 25,
331
+ 'redirection' => 5,
332
+ 'httpversion' => '1.0',
333
+ 'blocking' => true
334
+ );
335
+
336
+ # Handle POST Requests
337
+ if(isset($options[CURLOPT_POST]))
338
+ {
339
+ $params['method'] = 'POST';
340
+ $params['body'] = $options[CURLOPT_POSTFIELDS];
341
+ }
342
+
343
+ # Handle PUT
344
+ if(isset($options[CURLOPT_CUSTOMREQUEST])
345
+ && $options[CURLOPT_CUSTOMREQUEST] == 'PUT')
346
+ {
347
+ $params['method'] = 'PUT';
348
+ $params['body'] = $options[CURLOPT_POSTFIELDS];
349
+ }
350
+
351
+ $body = '{}';
352
+ $status = false;
353
+ $response = @wp_remote_post($url, $params);
354
+
355
+ if(isset($response['response'])
356
+ && isset($response['body'])
357
+ && isset($response['response']['code']))
358
+ {
359
+ $body = $response['body'];
360
+ $status = (string)$response['response']['code'];
361
+ }
362
+
363
+ return array($body, $status);
364
+ }
365
+
366
+ /**
367
+ * Issue a network request using cURL
368
+ * @param string $url
369
+ * @param array $options
370
+ * @return array(body, status_code)
371
+ */
372
+ protected function _curlGet($url, $options = array())
373
+ {
374
+ $curl_handle = curl_init($url);
375
+ $options += array(CURLOPT_RETURNTRANSFER => true);
376
+
377
+ curl_setopt_array($curl_handle, $options);
378
+
379
+ $body = curl_exec($curl_handle);
380
+ $status = (string)curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
381
+
382
+ return array($body, $status);
383
+ }
384
+
385
+
386
+ /**
387
+ * POST data to the server
388
+ * @param string $uri
389
+ * @param array $data Assoc. array of post data
390
+ * @return mixed
391
+ */
392
+ protected function _post($uri, $data)
393
+ {
394
+ return $this->_get($uri, array(
395
+ CURLOPT_POST => true,
396
+ CURLOPT_POSTFIELDS => $data)
397
+ );
398
+ }
399
+
400
+ /**
401
+ * PUT data to the server
402
+ * @param string $uri
403
+ * @param array $data Assoc. array of post data
404
+ * @return mixed
405
+ */
406
+ public function _put($uri, $data = false, $options = array())
407
+ {
408
+ $data = http_build_query($data);
409
+
410
+ $options = array (
411
+ CURLOPT_CUSTOMREQUEST => 'PUT',
412
+ CURLOPT_POSTFIELDS => $data
413
+ ) + $options;
414
+
415
+ $result = $this->_get($uri, $options);
416
+
417
+ return $result;
418
+ }
419
+
420
+ /**
421
+ * Build a valid request URL from the URI given and the API key
422
+ * @param string $uri
423
+ * @return string
424
+ */
425
+ protected function _buildRequestURL($uri, $query_args = array())
426
+ {
427
+ $uri = ltrim($uri, '/');
428
+
429
+ return ($this->use_ssl ? 'http://' : 'http://')
430
+ . $this->host
431
+ . '/api/'
432
+ . self::API_VERSION
433
+ . '/'
434
+ . $uri
435
+ . (count($query_args) ? '?' . http_build_query($query_args) : '')
436
+ . (count($query_args) ? '&' : '?')
437
+ . ($this->accessToken ? "access_token={$this->accessToken}" : '');
438
+ }
439
+ }
440
+
441
+ class Broadstreet_GeneralException extends Exception {}
442
+ class Broadstreet_DependencyException extends Broadstreet_GeneralException {}
443
+ class Broadstreet_AuthException extends Broadstreet_GeneralException {}
444
+ class Broadstreet_ServerException extends Broadstreet_GeneralException {
445
+ /**
446
+ * The error object
447
+ * @var object
448
+ */
449
+ public $error;
450
+ public function __construct($message, $error = '') {
451
+ $this->error = $error;
452
+ parent::__construct($message);
453
+ }
454
+ }
455
+
456
+ endif;
lib/Utility.php ADDED
@@ -0,0 +1,430 @@
1
+ <?php
2
+
3
+ require 'Broadstreet.php';
4
+
5
+ if(!class_exists('Broadstreet_Mini_Utility')):
6
+
7
+ function bs_get_option($name, $default = FALSE)
8
+ {
9
+ $value = get_option($name);
10
+ if( $value !== FALSE ) return $value;
11
+ return $default;
12
+ }
13
+
14
+ function bs_set_option($name, $value)
15
+ {
16
+ if (get_option($name) !== FALSE)
17
+ {
18
+ update_option($name, $value);
19
+ }
20
+ else
21
+ {
22
+ $deprecated = ' ';
23
+ $autoload = 'no';
24
+ add_option($name, $value, $deprecated, $autoload);
25
+ }
26
+ }
27
+
28
+ function bs_get_base_url($append = false)
29
+ {
30
+ $dir = basename(dirname(__FILE__));
31
+ return (WP_PLUGIN_URL . "/ad-widget/" . ($append ? $append : ''));
32
+ }
33
+
34
+ function bs_get_email()
35
+ {
36
+ return get_bloginfo('admin_email');
37
+ }
38
+
39
+ function bs_get_website()
40
+ {
41
+ return get_bloginfo('url');
42
+ }
43
+
44
+ function bs_get_website_name()
45
+ {
46
+ return get_bloginfo('url');
47
+ }
48
+
49
+ function bs_get_platform_version()
50
+ {
51
+ return get_bloginfo('version');
52
+ }
53
+
54
+
55
+ function bs_mail($to, $subject, $body)
56
+ {
57
+ @wp_mail($to, $subject, $body);
58
+ }
59
+
60
+
61
+ class Broadstreet_Mini_Utility
62
+ {
63
+ CONST KEY_ADSERVER_ENABLED = 'Broadstreet_Adserver_Enabled';
64
+ CONST KEY_API_KEY = 'Broadstreet_API_Key';
65
+ CONST KEY_NETWORK_ID = 'Broadstreet_Network_Key';
66
+ CONST KEY_ADVERTISER_ID = 'Broadstreet_Advertiser_Key';
67
+ CONST KEY_AD_LIST = 'Broadstreet_Ad_List';
68
+
69
+ /**
70
+ * Get the base URL of the Broadstreet Mini vendor plugin
71
+ * @param string $append A path to append to the base url
72
+ * @return string The final path
73
+ */
74
+ public static function getBaseURL($append = false)
75
+ {
76
+ return bs_get_base_url($append);
77
+ }
78
+
79
+ /**
80
+ * Sets a Wordpress option
81
+ * @param string $name The name of the option to set
82
+ * @param string $value The value of the option to set
83
+ */
84
+ public static function setOption($name, $value)
85
+ {
86
+ return bs_set_option($name, $value);
87
+ }
88
+
89
+ /**
90
+ * Gets a Wordpress option
91
+ * @param string $name The name of the option
92
+ * @param mixed $default The default value to return if one doesn't exist
93
+ * @return string The value if the option does exist
94
+ */
95
+ public static function getOption($name, $default = FALSE)
96
+ {
97
+ return bs_get_option($name, $default);
98
+ }
99
+
100
+ /**
101
+ * Send an email about an error, issue, etc
102
+ */
103
+ public static function sendReport($message = 'General')
104
+ {
105
+ $report = "";
106
+ $report .= bs_get_website_name(). "\n";
107
+ $report .= bs_get_website(). "\n";
108
+ $report .= bs_get_email(). "\n";
109
+ $report .= 'Platform Version: ' . bs_get_platform_version() . "\n";
110
+ $report .= "$message\n";
111
+
112
+ @bs_mail('errors@broadstreetads.com', "Status Report: WP AdWidget", $report);
113
+ }
114
+
115
+ /**
116
+ * Get a link to the Broadstreet interface
117
+ * @param string $path
118
+ * @return string
119
+ */
120
+ public static function broadstreetLink($path)
121
+ {
122
+ $path = ltrim($path, '/');
123
+ $key = self::getOption(Broadstreet_Mini::KEY_API_KEY);
124
+ $url = "https://my.broadstreetads.com/$path?access_token=$key";
125
+ return $url;
126
+ }
127
+
128
+ /**
129
+ * Get a key from an array without causing hell
130
+ * @param array $array
131
+ * @param string $key
132
+ * @param bool $default
133
+ */
134
+ public static function arrayGet($array, $key, $default = null)
135
+ {
136
+ if(isset($array[$key]))
137
+ return $array[$key];
138
+
139
+ return $default;
140
+ }
141
+
142
+ /**
143
+ * Get a nice string for an error message
144
+ * @param Broadstreet_ServerException $ex
145
+ */
146
+ public static function getPrettyError(Broadstreet_ServerException $ex)
147
+ {
148
+ $error = '';
149
+
150
+ if($ex instanceof Broadstreet_ServerException)
151
+ {
152
+ $error = 'Please check these item(s) are correct: <br />';
153
+ $api_response = (array)$ex->error;
154
+
155
+ foreach($api_response['errors'] as $field => $errors)
156
+ {
157
+ $error .= ucwords(str_replace('_', ' ', $field)) . '<br />';
158
+ }
159
+ }
160
+
161
+ return $error;
162
+ }
163
+
164
+ /*
165
+ * Determine whether the current site has been hooked up
166
+ * with Broadstreet
167
+ */
168
+ public static function hasNetwork()
169
+ {
170
+ return (bool)self::getOption(self::KEY_NETWORK_ID, false);
171
+ }
172
+
173
+ /*
174
+ * Determine whether the current site has been hooked up
175
+ * with Broadstreet
176
+ */
177
+ public static function hasAdserving($enabled = null, $email = false)
178
+ {
179
+ $success = false;
180
+ if($enabled !== null) {
181
+ self::setOption (Broadstreet_Mini_Utility::KEY_ADSERVER_ENABLED, (bool)$enabled);
182
+ $message = $enabled ? 'Subscribed' : 'Unsubscribed';
183
+ if($enabled) $success = self::importOldAds($email);
184
+ if($success) self::sendReport("Premium Adserver $message");
185
+ return $success;
186
+ } else {
187
+ return (bool)self::getOption(self::KEY_ADSERVER_ENABLED, false);
188
+ }
189
+ }
190
+
191
+ /*
192
+ * Determine whether the current site has been hooked up
193
+ * with Broadstreet
194
+ */
195
+ public static function getNetworkID()
196
+ {
197
+ return self::getOption(self::KEY_NETWORK_ID, false);
198
+ }
199
+
200
+ /**
201
+ * Escape a javascript tag
202
+ * @param string $tag
203
+ */
204
+ public static function escapeJSTag($tag)
205
+ {
206
+ $tag = str_ireplace('<script>', '\x3Cscript>', $tag);
207
+ $tag = str_ireplace('</script>', '\x3C/script>', $tag);
208
+
209
+ return $tag;
210
+ }
211
+
212
+ /**
213
+ * Get a Broadstreet API client
214
+ * @return Broadstreet
215
+ */
216
+ public static function getClient()
217
+ {
218
+ $key = self::getOption(self::KEY_API_KEY);
219
+
220
+ if($key)
221
+ return new Broadstreet($key);
222
+ else
223
+ return new Broadstreet();
224
+ }
225
+
226
+ /**
227
+ * Does this account have any free ads left?
228
+ */
229
+ public static function hasFreeAds()
230
+ {
231
+ $net_id = self::getOption(Broadstreet_Mini::KEY_NETWORK_ID);
232
+
233
+ # If we haven't seen them before they probably do
234
+ if(!$net_id) return true;
235
+
236
+ $net = self::getClient()->getNetwork($net_id);
237
+
238
+ # Check if you've used up all the hacks
239
+ # Note to l33t haxors. We check on the server side too.
240
+ return ($net->comp_count < $net->comp_count_max);
241
+ }
242
+
243
+ /**
244
+ * Run a function which may or may not be defined
245
+ * @param string $name
246
+ * @param array $args
247
+ */
248
+ public static function runHook($name, $args = array())
249
+ {
250
+ if(function_exists($name))
251
+ {
252
+ return call_user_func($name, $args);
253
+ }
254
+
255
+ return null;
256
+ }
257
+
258
+ /**
259
+ * Print a link to open an editable link
260
+ * @param type $label_or_markup
261
+ */
262
+ public static function editableLink($label_or_markup = false, $key = 'solo')
263
+ {
264
+ if(!$label_or_markup)
265
+ $label_or_markup = '<img alt="Create Editable" src="'.Broadstreet_Mini_Utility::getBaseURL('/assets/img/editable-button.png').'" />';
266
+ echo '<a href="#" onclick="editable_'.$key.'(); return false;">'.$label_or_markup.'</a>';
267
+ }
268
+
269
+ /**
270
+ * Output JS for placing the ad HTML into the
271
+ * new ad form
272
+ */
273
+ public static function editableJS($selector = false, $key = 'solo')
274
+ {
275
+ bs_editable_js($selector, $key);
276
+ }
277
+
278
+ /**
279
+ * Is this phone number valid?
280
+ * @param string $num
281
+ * @return boolean
282
+ */
283
+ public static function isPhoneValid($num)
284
+ {
285
+ if(preg_match('/^[+]?([0-9]?[0-9]?[0-9]?)[(|s|-|.]?([0-9]{3})[)|s|-|.]*([0-9]{3})[s|-|.]*([0-9]{4})#x2F;', $num))
286
+ {
287
+ return true;
288
+ }
289
+ else
290
+ {
291
+ return false;
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Import or update an image ad
297
+ * @param type $network_id Network Id
298
+ * @param type $advertiser_id Advertiser Id
299
+ * @param type $image_url Image URL
300
+ * @param type $link Destination URL
301
+ */
302
+ public static function importImageAd($network_id, $advertiser_id, $image_url, $link, $advertisement_id = false) {
303
+ $api = self::getClient();
304
+
305
+ $params = array();
306
+ $params['name'] = 'WordPress Widget Ad ' . date('Y-m-d H:i:s');
307
+ $params['active_base64'] = base64_encode(file_get_contents($image_url));
308
+ $params['destination'] = $link;
309
+
310
+ try {
311
+ if($advertisement_id === false)
312
+ return $api->createAdvertisement($network_id, $advertiser_id, $params['name'], 'static', $params);
313
+ else
314
+ return $api->updateAdvertisement($network_id, $advertiser_id, $advertisement_id, $params);
315
+
316
+ } catch(Exception $ex) {
317
+ self::sendReport($ex->__toString());
318
+ exit($ex->__toString());
319
+ return false;
320
+ }
321
+ }
322
+
323
+ /**
324
+ * Import or update an HTML Ad into Broadstreet
325
+ * @param type $network_id
326
+ * @param type $advertiser_id
327
+ * @param type $html
328
+ */
329
+ public static function importHTMLAd($network_id, $advertiser_id, $html, $advertisement_id = false) {
330
+ $api = self::getClient();
331
+
332
+ $params = array();
333
+ $params['name'] = 'WordPress Widget Ad ' . date('Y-m-d H:i:s');
334
+ $params['html'] = $html;
335
+
336
+ try {
337
+ if($advertisement_id === false)
338
+ return $api->createAdvertisement($network_id, $advertiser_id, $params['name'], 'html', $params);
339
+ else
340
+ return $api->updateAdvertisement($network_id, $advertiser_id, $advertisement_id, $params);
341
+
342
+ } catch(Exception $ex) {
343
+ self::sendReport($ex->__toString());
344
+ exit($ex->__toString());
345
+ return false;
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Import old adwidget ads to Broadstreet ads
351
+ * @param string $email
352
+ */
353
+ public static function importOldAds($email = false) {
354
+ $api = new Broadstreet();
355
+
356
+ try
357
+ {
358
+ if(!Broadstreet_Mini_Utility::hasNetwork())
359
+ {
360
+ # Register the user by email address
361
+ $user = $api->register($email);
362
+ Broadstreet_Mini_Utility::setOption(Broadstreet_Mini_Utility::KEY_API_KEY, $user->access_token);
363
+
364
+ # Create a network for the new user
365
+ # Don't change this unless you want a higher tier. There's no lower tier, you haxor you
366
+ $net = $api->createNetwork('Wordpress - ' . get_bloginfo('name'), array('tier_id' => 4));
367
+ Broadstreet_Mini_Utility::setOption(Broadstreet_Mini_Utility::KEY_NETWORK_ID, $net->id);
368
+ }
369
+ else
370
+ {
371
+ $api = self::getClient();
372
+ $net = (object)array('id' => Broadstreet_Mini_Utility::getNetworkID());
373
+ }
374
+
375
+ /* Import Image widgets */
376
+ $ads = Broadstreet_Mini_Utility::getOption('widget_adwidget_imagewidget');
377
+
378
+ foreach($ads as $id => $data)
379
+ {
380
+ /* Ad already imported? Skip it */
381
+ if(!is_numeric($id) || is_numeric(@$data['bs_ad_id'])) continue;
382
+
383
+ $adv = $api->createAdvertiser($net->id, self::arrayGet($data, 'w_adv', 'New Advertiser - Image'));
384
+ Broadstreet_Mini_Utility::setOption(Broadstreet_Mini_Utility::KEY_ADVERTISER_ID, $adv->id);
385
+
386
+ $ad = self::importImageAd($net->id, $adv->id, $data['w_img'], $data['w_link']);
387
+
388
+ if(!$ad) continue;
389
+
390
+ $ads[$id]['bs_ad_html'] = $ad->html;
391
+ $ads[$id]['bs_ad_id'] = $ad->id;
392
+ $ads[$id]['bs_adv_id'] = $adv->id;
393
+ }
394
+
395
+ Broadstreet_Mini_Utility::setOption('widget_adwidget_imagewidget', $ads);
396
+
397
+
398
+ /* Import HTML widgets */
399
+ $ads = Broadstreet_Mini_Utility::getOption('widget_adwidget_htmlwidget');
400
+
401
+ foreach($ads as $id => $data)
402
+ {
403
+ /* Ad already imported? Skip it */
404
+ if(!is_numeric($id) || is_numeric(@$data['bs_ad_id'])) continue;
405
+
406
+ $adv = $api->createAdvertiser($net->id, self::arrayGet($data, 'w_adv', 'New Advertiser - HTML'));
407
+ Broadstreet_Mini_Utility::setOption(Broadstreet_Mini_Utility::KEY_ADVERTISER_ID, $adv->id);
408
+
409
+ $ad = self::importHTMLAd($net->id, $adv->id, $data['w_adcode']);
410
+
411
+ if(!$ad) continue;
412
+
413
+ $ads[$id]['bs_ad_html'] = $ad->html;
414
+ $ads[$id]['bs_ad_id'] = $ad->id;
415
+ $ads[$id]['bs_adv_id'] = $adv->id;
416
+ }
417
+
418
+ Broadstreet_Mini_Utility::setOption('widget_adwidget_htmlwidget', $ads);
419
+ }
420
+ catch(Exception $ex)
421
+ {
422
+ self::sendReport($ex->__toString());
423
+ return false;
424
+ }
425
+
426
+ return true;
427
+ }
428
+ }
429
+
430
+ endif;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Broadstreet
3
Tags: wordpress,ad,widget,sidebar,google,tag,code
4
Requires at least: 3.0
5
Tested up to: 3.5.1
6
- Stable tag: 2.1.6
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,15 +13,16 @@ 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
* Extremely intuitive for beginners
17
* No clunky ad management interface
18
* Easily place image banner ads
19
* Easily place Google ad tags and other ad code
20
21
You will not find an easier way to run ads on your website!
22
23
- Watch a short video demo: http://www.screenr.com/u0t7
24
-
25
== Demo ==
26
27
Watch a short video demo: http://www.screenr.com/u0t7
3
Tags: wordpress,ad,widget,sidebar,google,tag,code
4
Requires at least: 3.0
5
Tested up to: 3.5.1
6
+ Stable tag: 2.2.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: http://www.screenr.com/u0t7
17
+
18
* Extremely intuitive for beginners
19
* No clunky ad management interface
20
* Easily place image banner ads
21
* Easily place Google ad tags and other ad code
22
+ * Easily upgrade to **cloud-based adserving power** backed by [Broadstreet Ads](http://broadstreetads.com)
23
24
You will not find an easier way to run ads on your website!
25
26
== Demo ==
27
28
Watch a short video demo: http://www.screenr.com/u0t7
views/admin.php CHANGED
@@ -19,6 +19,34 @@
19
<script type="text/javascript" src="http://cdn.broadstreetads.com/init.js"></script>
20
<script type="text/javascript">broadstreet.zone(423);</script>
21
22
<p>Thank you for using our plugin! This plugin was built by <a href="http://broadstreetads.com">Broadstreet</a>, the
23
company for independent publishers.</p>
24
19
<script type="text/javascript" src="http://cdn.broadstreetads.com/init.js"></script>
20
<script type="text/javascript">broadstreet.zone(423);</script>
21
22
+ <?php if(Broadstreet_Mini_Utility::hasAdserving()): ?>
23
+
24
+ <h2>Adserver Subscription</h2>
25
+
26
+ You are currently subscribed to Broadstreet's Adserver, giving your site stress-free adserving,
27
+ and click/view reporting. You can cancel this subscription here. Canceling will revert
28
+ your ads to start serving from your site instead of an adserver.
29
+
30
+ <form method="post">
31
+ <input style="background-color: red; color: white;" type="submit" name="cancel" value="Cancel Adserving Subscription">
32
+ </form>
33
+
34
+ <?php endif; ?>
35
+
36
+ <?php if(!Broadstreet_Mini_Utility::hasAdserving() && Broadstreet_Mini_Utility::hasNetwork()): ?>
37
+
38
+ <h2>Adserver Subscription</h2>
39
+
40
+ You were once subscribed to Broadstreet's Adserver, giving your site stress-free adserving,
41
+ and click/view reporting. You can re-enable your subscription here. Changes will
42
+ be immediate.
43
+
44
+ <form method="post">
45
+ <input style="background-color: green; color: white;" type="submit" name="subscribe" value="Subscribe me for $5 / month">
46
+ </form>
47
+
48
+ <?php endif; ?>
49
+
50
<p>Thank you for using our plugin! This plugin was built by <a href="http://broadstreetads.com">Broadstreet</a>, the
51
company for independent publishers.</p>
52
views/modal/footer.php ADDED
@@ -0,0 +1,15 @@
1
+ <div id="footer">
2
+ Broadstreet Ads &copy; <?php echo date('Y') ?> &minus; www.broadstreetads.com
3
+ </div>
4
+ <script src="https://broadstreet-common.s3.amazonaws.com/broadstreet-net/init.js"></script>
5
+ <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
6
+ <script type="text/javascript">
7
+
8
+ var broadstreet = new Broadstreet.Network();
9
+ broadstreet.getNetworkStats(function(data){
10
+ $('#pub-count').text(data.network_count);
11
+ });
12
+
13
+ </script>
14
+ </body>
15
+ </html>
views/modal/header.php ADDED
@@ -0,0 +1,174 @@
1
+ <html>
2
+ <head>
3
+ <title>Broadstreet Premium Signup</title>
4
+ <style type="text/css">
5
+ /* Broadstreet CSS */
6
+ body {
7
+ font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
8
+ font-size: 12px;
9
+ font-style: normal;
10
+ font-variant: normal;
11
+ font-weight: normal;
12
+ margin: 0;
13
+ padding: 0;
14
+ background: rgb(255,255,255); /* Old browsers */
15
+ background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); /* FF3.6+ */
16
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(47%,rgba(246,246,246,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */
17
+ background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
18
+ background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
19
+ background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* IE10+ */
20
+ background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* W3C */
21
+ }
22
+
23
+ #header {
24
+ padding: 10px 15px;
25
+ background-color: #eee;
26
+ border-bottom: 1px solid #ccc;
27
+ background: rgb(255,255,255); /* Old browsers */
28
+ background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); /* FF3.6+ */
29
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(47%,rgba(246,246,246,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */
30
+ background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */
31
+ background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */
32
+ background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* IE10+ */
33
+ background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%); /* W3C */
34
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
35
+ }
36
+
37
+ #header h1 {
38
+ font-size: 24px;
39
+ text-align: center;
40
+ font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', sans-serif;
41
+ font-weight: normal;
42
+ }
43
+
44
+ #header h1 > * {
45
+ vertical-align: bottom;
46
+ }
47
+
48
+ h2 {
49
+ font-size: 18px;
50
+ font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', sans-serif;
51
+ text-align: center;
52
+ font-weight: normal;
53
+ padding: 5px 10px;
54
+ }
55
+
56
+ #clients {
57
+ width: 100%;
58
+ }
59
+
60
+ #clients td {
61
+ text-align: center;
62
+ }
63
+
64
+ #clients td img {
65
+ -moz-box-shadow: 0 0 5px #888;
66
+ -webkit-box-shadow: 0 0 5px#888;
67
+ box-shadow: 0 0 5px #888;
68
+ width: 140px;
69
+ }
70
+
71
+ #clients-section {
72
+ padding: 10px 0px;
73
+ background: #258dc8; /* Old browsers */
74
+ background: -moz-linear-gradient(top, #258dc8 0%, #258dc8 100%); /* FF3.6+ */
75
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#258dc8), color-stop(100%,#258dc8)); /* Chrome,Safari4+ */
76
+ background: -webkit-linear-gradient(top, #258dc8 0%,#258dc8 100%); /* Chrome10+,Safari5.1+ */
77
+ background: -o-linear-gradient(top, #258dc8 0%,#258dc8 100%); /* Opera 11.10+ */
78
+ background: -ms-linear-gradient(top, #258dc8 0%,#258dc8 100%); /* IE10+ */
79
+ background: linear-gradient(to bottom, #258dc8 0%,#258dc8 100%); /* W3C */
80
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#258dc8', endColorstr='#258dc8',GradientType=0 ); /* IE6-9 */
81
+
82
+ }
83
+
84
+ a.btn {
85
+ font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', sans-serif;
86
+ text-decoration: none;
87
+ line-height: inherit;
88
+ font-weight: inherit;
89
+ cursor: pointer;
90
+ display: inline-block;
91
+ background-color: #E6E6E6;
92
+ background-repeat: no-repeat;
93
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(white), color-stop(25%, white), to(#E6E6E6));
94
+ background-image: -webkit-linear-gradient(white, white 25%, #E6E6E6);
95
+ background-image: -moz-linear-gradient(top, white, white 25%, #E6E6E6);
96
+ background-image: -ms-linear-gradient(white, white 25%, #E6E6E6);
97
+ background-image: -o-linear-gradient(white, white 25%, #E6E6E6);
98
+ background-image: linear-gradient(white, white 25%, #E6E6E6);
99
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
100
+ padding: 5px 14px 6px;
101
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
102
+ color: #333;
103
+ font-size: 13px;
104
+ line-height: normal;
105
+ border: 1px solid #CCC;
106
+ border-bottom-color: #BBB;
107
+ -webkit-border-radius: 4px;
108
+ -moz-border-radius: 4px;
109
+ border-radius: 4px;
110
+ -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);
111
+ -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);
112
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);
113
+ -webkit-transition: 0.1s linear all;
114
+ -moz-transition: 0.1s linear all;
115
+ -ms-transition: 0.1s linear all;
116
+ -o-transition: 0.1s linear all;
117
+ transition: 0.1s linear all;
118
+ font-size: 15px;
119
+ line-height: normal;
120
+ padding: 9px 14px 9px;
121
+ -webkit-border-radius: 6px;
122
+ -moz-border-radius: 6px;
123
+ }
124
+
125
+
126
+ a.btn.smaller {
127
+ padding: 4px 12px;
128
+ }
129
+
130
+ a.call-to-action {
131
+ color: white;
132
+ border-radius: 6px;
133
+ background-color: #57A957;
134
+ background-repeat: repeat-x;
135
+ background-image: -khtml-gradient(linear, left top, left bottom, from(#62C462), to(#57A957));
136
+ background-image: -moz-linear-gradient(top, #62C462, #57A957);
137
+ background-image: -ms-linear-gradient(top, #62C462, #57A957);
138
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62C462), color-stop(100%, #57A957));
139
+ background-image: -webkit-linear-gradient(top, #62C462, #57A957);
140
+ background-image: -o-linear-gradient(top, #62C462, #57A957);
141
+ background-image: linear-gradient(top, #62C462, #57A957);
142
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);
143
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
144
+ border-color: #57A957 #57A957 #3D773D;
145
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
146
+
147
+ }
148
+
149
+ #call-to-action {
150
+ padding-top: 30px;
151
+ text-align: center;
152
+ }
153
+
154
+ #footer {
155
+ position: fixed;
156
+ bottom: 0px;
157
+ height: 20px;
158
+ background-color: #444;
159
+ color: #ccc;
160
+ width: 100%;
161
+ text-align: center;
162
+ }
163
+
164
+ #signup input, #report input {
165
+ height: 38px;
166
+ width: 200px;
167
+ font-size: 16px;
168
+ border: 1px solid #ccc;
169
+ border-radius: 4px;
170
+ padding-left: 4px;
171
+ }
172
+ </style>
173
+ </head>
174
+ <body>
views/modal/index.php ADDED
@@ -0,0 +1,69 @@
1
+ <?php
2
+ /**
3
+ * We need to do a little handywork to make sure that Wordpress
4
+ * thinks we're a standard built-in modal.
5
+ */
6
+
7
+ # Include this so Wordpress doesn't throw NOTICEs when setting $pagenow
8
+ $_SERVER['PHP_SELF'] = '/wp-admin';
9
+
10
+ # Turn on DEBUG if needed
11
+ if(defined('BROADSTREET_DEBUG') && BROADSTREET_DEBUG) {
12
+ error_reporting(E_ALL);
13
+ ini_set('display_errors', 1);
14
+ ini_set('log_errors', 1);
15
+ }
16
+
17
+ if(!isset( $_GET['inline']))
18
+ define('IFRAME_REQUEST', true);
19
+
20
+ # Include libraries
21
+ require_once '../../lib/Utility.php';
22
+ require_once '../../lib/Broadstreet.php';
23
+
24
+ if(!defined('WP_ADMIN'))
25
+ {
26
+ # Find the wp-admin directory
27
+ if(!preg_match('#(.*)/wp-content/plugins/#', $_SERVER['SCRIPT_FILENAME'], $matches))
28
+ exit("We're awfully sorry. You have a strange server configuration we can't figure out. Email us, and we'll help figure it out. errors@broadstreetads.com");
29
+
30
+ $root = $matches[1];
31
+
32
+ chdir("$root/wp-admin");
33
+
34
+ /** Load WordPress Administration Bootstrap **/
35
+ require_once('./admin.php');
36
+ }
37
+
38
+ $page = @$_GET['step'];
39
+ if(!$page) $page = 'signup';
40
+
41
+ if($page == 'signup')
42
+ {
43
+ if(Broadstreet_Mini_Utility::hasAdserving() || @$_GET['status'] == 'agree') {
44
+
45
+ if(!Broadstreet_Mini_Utility::hasAdserving())
46
+ {
47
+ # New user
48
+ if(!isset($_POST['resub']))
49
+ {
50
+ $email = $_POST['email'];
51
+ $success = Broadstreet_Mini_Utility::hasAdserving(true, $email);
52
+ }
53
+ else
54
+ {
55
+ # Someone who cancelled and resubscribed
56
+ $success = Broadstreet_Mini_Utility::hasAdserving(true);
57
+ }
58
+
59
+ if(!$success) exit("We're sorry! We couldn't upgrade you to premium adserving! Is your email address already linked to a Broadstreet account? This may be the problem.");
60
+ }
61
+
62
+ require "signedup.php";
63
+ exit;
64
+ }
65
+ }
66
+
67
+
68
+ require "$page.php";
69
+
views/modal/reports.php ADDED
@@ -0,0 +1,96 @@
1
+ <?php
2
+
3
+ $ad_id = $_GET['ad_id'];
4
+ $adv_id = $_GET['adv_id'];
5
+ $net_id = Broadstreet_Mini_Utility::getNetworkID();
6
+
7
+ $start = @$_GET['start'];
8
+ $end = @$_GET['end'];
9
+
10
+ $day = 60 * 60 * 24 * 31;
11
+
12
+ if($start && !$end) $end = date('Y-m-d');
13
+ if($end && !$start) $start = date('Y-m-d', strtotime($end) - $day);
14
+ if(!$start && !$end) { $end = date('Y-m-d'); $start = date('Y-m-d', time() - $day); }
15
+
16
+ $api = Broadstreet_Mini_Utility::getClient();
17
+ $error = false;
18
+ $stats = array();
19
+
20
+ try {
21
+ $stats = $api->getAdvertisementReport($net_id, $adv_id, $ad_id, $start, $end);
22
+ } catch(Exception $ex) {
23
+ $error = 'There was an error retrieving your report. Try selecting a valid date range of 2 years or smaller.';
24
+ }
25
+
26
+ ?>
27
+ <?php require 'header.php' ?>
28
+ <style type="text/css">
29
+ .datagrid table { border-collapse: collapse; text-align: left; width: 100%; } .datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #006699; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }.datagrid table td, .datagrid table th { padding: 3px 10px; }.datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #0070A8; } .datagrid table thead th:first-child { border: none; }.datagrid table tbody td { color: #00557F; border-left: 1px solid #E1EEF4;font-size: 12px;font-weight: normal; }.datagrid table tbody .alt td { background: #E1EEf4; color: #00557F; }.datagrid table tbody td:first-child { border-left: none; }.datagrid table tbody tr:last-child td { border-bottom: none; }.datagrid table tfoot td div { border-top: 1px solid #006699;background: #E1EEf4;} .datagrid table tfoot td { padding: 0; font-size: 12px } .datagrid table tfoot td div{ padding: 2px; }.datagrid table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }.datagrid table tfoot li { display: inline; }.datagrid table tfoot li a { text-decoration: none; display: inline-block; padding: 2px 8px; margin: 1px;color: #FFFFFF;border: 1px solid #006699;-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; }.datagrid table tfoot ul.active, .datagrid table tfoot ul a:hover { text-decoration: none;border-color: #00557F; color: #FFFFFF; background: none; background-color:#006699;}
30
+ body { padding-bottom: 50px; }
31
+ .date-container {
32
+ background-color: #fff;
33
+ padding: 10px;
34
+ text-align: center;
35
+ }
36
+ .alert {
37
+ padding: 8px 35px 8px 14px;
38
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
39
+ background-color: #fcf8e3;
40
+ border: 1px solid #fbeed5;
41
+ }
42
+ .alert-error {
43
+ color: #b94a48;
44
+ background-color: #f2dede;
45
+ border-color: #eed3d7;
46
+ }
47
+
48
+ </style>
49
+ <div id="header">
50
+ <h1>Click Report from <?php echo $start ?> to <?php echo $end ?></h1>
51
+ </div>
52
+ <?php if($error): ?>
53
+ <div class="alert alert-error">
54
+ <?php echo $error; ?>
55
+ </div>
56
+ <?php endif; ?>
57
+ <div class="date-container">
58
+ <form id="report" action="?" method="get">
59
+ <input type="text" name="start" placeholder="your@email.com" value="<?php echo $start ?>" />
60
+ &nbsp;&nbsp;&nbsp;&nbsp; through &nbsp;&nbsp;&nbsp;&nbsp;
61
+ <input type="text" name="end" placeholder="your@email.com" value="<?php echo $end ?>" />
62
+ <input type="hidden" name="ad_id" value="<?php echo $ad_id ?>" />
63
+ <input type="hidden" name="adv_id" value="<?php echo $adv_id ?>" />
64
+ <input type="hidden" name="step" value="reports" />
65
+ <a href="#" onclick="$('#report').submit();" class="btn call-to-action">Go </a>
66
+ </form>
67
+ </div>
68
+ <div style="padding: 0px 0px 5px 5px; color: #808080;">* Stats are delayed by roughly 10 minutes</div>
69
+ <div style="margin: 0 5px;" class="datagrid">
70
+ <table id="stats">
71
+ <thead>
72
+ <tr>
73
+ <th>Date</th>
74
+ <th>Views</th>
75
+ <th>Clicks</th>
76
+ <th>Click-Through Rate</th>
77
+ </tr>
78
+ </thead>
79
+ <tbody>
80
+ <?php if(count($stats)): ?>
81
+ <?php $count = 0; foreach($stats as $day): ?>
82
+ <tr <?php if($count % 2 == 0) echo "class='alt'" ?>>
83
+ <td><?php echo $day->date ?></td>
84
+ <td><?php echo $day->views ?></td>
85
+ <td><?php echo $day->clicks ?></td>
86
+ <td><?php if($day->views == 0) echo 'NA'; else echo round($day->clicks / $day->views, 2) . '' ?></td>
87
+ </tr>
88
+ <?php $count++; endforeach; ?>
89
+ <?php endif; ?>
90
+ </tbody>
91
+ </table>
92
+ </div>
93
+ <div id="call-to-action">
94
+ <a href="#" onclick="(window.dialogArguments || opener || parent || top).tb_remove(); return false;" class="btn call-to-action">Close</a>
95
+ </div>
96
+ <?php require 'footer.php' ?>
views/modal/signedup.php ADDED
@@ -0,0 +1,49 @@
1
+ <?php require 'header.php' ?>
2
+ <div id="header">
3
+ <h1>Welcome to the Club!</h1>
4
+ </div>
5
+ <div id="clients-section">
6
+ <table id="clients">
7
+ <tr>
8
+ <td><a href="http://baristanet.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/baristanet.png" /></a></td>
9
+ <td><a href="http://thebatavian.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/batavian.png" /></a></td>
10
+ <td><a href="http://arlnow.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/arlingtonnow.png" /></a></td>
11
+ <td><a href="http://hulafrog.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/hulafrog.png" /></a></td>
12
+ </tr>
13
+ <tr>
14
+ <td><a href="http://natomasbuzz.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/natomas.png" /></a></td>
15
+ <td><a href="http://www.sheepsheadbites.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/sheepshead.png" /></a></td>
16
+ <td><a href="http://www.pvpost.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/pvpost.png" /></a></td>
17
+ <td><a href="http://njnewscommons.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/njnewscommons.png" /></a></td>
18
+ </tr>
19
+ </table>
20
+ </div>
21
+ <div id="info">
22
+
23
+ <h2>
24
+ Your existing ads and any ads you create going forward will
25
+ have reporting available and be hosting in our cloud. You will
26
+ soon receive a welcome email. Thank you for taking a spin with Broadstreet!
27
+ <br />
28
+ <small><strong>Be sure to save unsaved widgets and refresh the widgets page after closing this window.</strong></small>
29
+ </h2>
30
+ <div id="call-to-action">
31
+ <a href="#" onclick="bs_close()" class="btn call-to-action">Close this Window</a>
32
+ </div>
33
+
34
+ </div>
35
+ <script>
36
+ function bs_close() {
37
+ var win = window.dialogArguments || opener || parent || top;
38
+
39
+ if(typeof win.send_to_editor === 'function')
40
+ {
41
+ win.send_to_editor();
42
+ }
43
+ else
44
+ {
45
+ win.tb_remove();
46
+ }
47
+ }
48
+ </script>
49
+ <?php require 'footer.php' ?>
views/modal/signup.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php require 'header.php' ?>
2
+ <div id="header">
3
+ <h1>Join <span id="pub-count">500+</span> Publishers Who Upgraded</h1>
4
+ </div>
5
+ <div id="clients-section">
6
+ <table id="clients">
7
+ <tr>
8
+ <td><a href="http://baristanet.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/baristanet.png" /></a></td>
9
+ <td><a href="http://thebatavian.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/batavian.png" /></a></td>
10
+ <td><a href="http://arlnow.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/arlingtonnow.png" /></a></td>
11
+ <td><a href="http://hulafrog.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/hulafrog.png" /></a></td>
12
+ </tr>
13
+ <tr>
14
+ <td><a href="http://natomasbuzz.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/natomas.png" /></a></td>
15
+ <td><a href="http://www.sheepsheadbites.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/sheepshead.png" /></a></td>
16
+ <td><a href="http://www.pvpost.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/pvpost.png" /></a></td>
17
+ <td><a href="http://njnewscommons.com/"><img src="http://broadstreetads.com/assets/images/featured-clients/njnewscommons.png" /></a></td>
18
+ </tr>
19
+ </table>
20
+ </div>
21
+ <div id="info">
22
+ <h2>You will be able to see <strong>reports on ad views and clicks</strong>. And best of all,
23
+ ads will be served using
24
+ <a target="_blank" href="http://broadstreetads.com">Broadstreet Ads</a>' ultra-fast adserver.</h2>
25
+ </div>
26
+ <div id="call-to-action">
27
+ <form id="signup" action="?step=signup&status=agree" method="post">
28
+ <?php if(!Broadstreet_Mini_Utility::getNetworkID()): ?>
29
+ <input id="email" type="text" name="email" placeholder="your@email.com" value="<?php echo get_bloginfo('admin_email') ?>" />
30
+ <a href="#" onclick="$('#signup').submit();" class="btn call-to-action">$5 / month. Click for an Instant Signup</a>
31
+ <?php else: ?>
32
+ <input type="hidden" name="resub" value="1" />
33
+ <a href="#" onclick="$('#signup').submit();" class="btn call-to-action">$5 / month. Click to re-subscribe.</a>
34
+ <?php endif; ?>
35
+ </form>
36
+ </div>
37
+ <?php require 'footer.php' ?>