/** * Display the widget update form * @param array $instance */ function form($instance) { $link_id = $this->get_field_id('w_link'); $img_id = $this->get_field_id('w_img'); $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_adv' => 'New Advertiser', 'w_resize' => 'no', 'w_new' => 'no'); $instance = wp_parse_args((array) $instance, $defaults); $img = $instance['w_img']; $link = $instance['w_link']; $adv = $instance['w_adv']; ?> <div class="widget-content"> <p style="text-align: center;" class="bs-proof"> <?php if ($instance['w_img']) { ?> Your ad is ready. <br/><br/><strong>Scaled Visual:</strong><br/> <div class="bs-proof"><img style="width:100%;" src="<?php echo $instance['w_img']; ?> " alt="Ad" /></div><br/> <?php } ?> <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. </p> <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']); ?> " /> <br/><br/> <p> <label for="<?php echo $this->get_field_id('w_link'); ?> ">Ad Click Destination:</label><br/> <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']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('w_adv'); ?> ">Advertiser Name:</label><br/> <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']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('w_resize'); ?> ">Auto Resize to Max Width? </label> <input type="checkbox" name="<?php echo $this->get_field_name('w_resize'); ?> " value="yes" <?php if ($instance['w_resize'] == 'yes') { echo 'checked'; } ?> /> </p> <p> <label for="<?php echo $this->get_field_id('w_new'); ?> ">Open in New Window? </label> <input type="checkbox" name="<?php echo $this->get_field_name('w_new'); ?> " value="yes" <?php if ($instance['w_new'] == 'yes') { echo 'checked'; } ?> /> </p> <p> <span style="color: green; font-weight: bold;">Tip:</span> If you're using this widget, you might also find <a target="_blank" href="http://broadstreetads.com/ad-platform/ad-formats/">our special ad formats for sales people and publishers</a> useful. </p> <?php if (!Broadstreet_Adwidget_Mini_Utility::hasAdserving()) { ?> <p> When you're ready for a more powerful adserver with click reporting <a target="_blank" href="#" onclick="broadstreet_upgrade(); return false;">click here</a>. <script language="javascript"> if(!window.broadstreet_upgrade) { function broadstreet_upgrade() { window.send_to_editor = function(html) { tb_remove(); alert('Save any unsaved widgets and refresh this page to see new upgraded options'); }; tb_show('Broadstreet', '<?php echo bsadwidget_get_base_url('views/modal/'); ?> ' + '?fake=fake&width=650&height=580&TB_iframe=true'); } } </script> </p> <?php } elseif (isset($instance['bs_ad_id'])) { ?> <p> Reporting: <a target="_blank" href="#" onclick="broadstreet_reports(); return false;">View stats for clicks and views</a> <script language="javascript"> if(!window.broadstreet_reports) { function broadstreet_reports() { window.send_to_editor = function(html) { tb_remove(); }; tb_show('Broadstreet', '<?php echo bsadwidget_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'); } } </script> </p> <?php } ?> </div> <?php }
$adv_id = sanitize_text_field($_GET['adv_id']); $net_id = Broadstreet_Adwidget_Mini_Utility::getNetworkID(); $start = sanitize_text_field(@$_GET['start']); $end = sanitize_text_field(@$_GET['end']); $day = 60 * 60 * 24 * 31; if ($start && !$end) { $end = date('Y-m-d'); } if ($end && !$start) { $start = date('Y-m-d', strtotime($end) - $day); } if (!$start && !$end) { $end = date('Y-m-d'); $start = date('Y-m-d', time() - $day); } $api = Broadstreet_Adwidget_Mini_Utility::getClient(); $error = false; $stats = array(); try { $stats = $api->getAdvertisementReport($net_id, $adv_id, $ad_id, $start, $end); } catch (Exception $ex) { $error = 'There was an error retrieving your report. Try selecting a valid date range of 2 years or smaller.'; } require 'header.php'; ?> <style type="text/css"> .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;} body { padding-bottom: 50px; } .date-container { background-color: #fff; padding: 10px;
} $root = $matches[1]; chdir("{$root}/wp-admin"); /** Load WordPress Administration Bootstrap **/ require_once './admin.php'; } $page = @$_GET['step']; if (!$page) { $page = 'signup'; } if ($page == 'signup') { if (Broadstreet_Adwidget_Mini_Utility::hasAdserving() || @$_GET['status'] == 'agree') { if (!Broadstreet_Adwidget_Mini_Utility::hasAdserving()) { # New user if (!isset($_POST['resub'])) { $email = $_POST['email']; $success = Broadstreet_Adwidget_Mini_Utility::hasAdserving(true, $email); } else { # Someone who cancelled and resubscribed $success = Broadstreet_Adwidget_Mini_Utility::hasAdserving(true); } 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."); } } require "signedup.php"; exit; } } Broadstreet_Adwidget_Mini_Utility::sendReport('Premium Exloration'); require "{$page}.php";
<td><a href="http://thebatavian.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/batavian.png" /></a></td> <td><a href="http://arlnow.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/arlingtonnow.png" /></a></td> <td><a href="http://hulafrog.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/hulafrog.png" /></a></td> </tr> <tr> <td><a href="http://natomasbuzz.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/natomas.png" /></a></td> <td><a href="http://www.sheepsheadbites.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/sheepshead.png" /></a></td> <td><a href="http://www.pvpost.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/pvpost.png" /></a></td> <td><a href="http://njnewscommons.com/"><img src="http://broadstreetads.com/assets/app/images/featured-clients/njnewscommons.png" /></a></td> </tr> </table> </div> <div id="call-to-action"> <form id="signup" action="?step=signup&status=agree" method="post"> <?php if (!Broadstreet_Adwidget_Mini_Utility::getNetworkID()) { ?> <input id="email" type="text" name="email" placeholder="*****@*****.**" value="<?php echo get_bloginfo('admin_email'); ?> " /> <a href="#" onclick="$('#signup').submit();" class="btn call-to-action">$5 / month. Click for an Instant Signup</a> <?php } else { ?> <input type="hidden" name="resub" value="1" /> <a href="#" onclick="$('#signup').submit();" class="btn call-to-action">$5 / month. Click to re-subscribe.</a> <?php } ?> </form>
<h2>Adserver Subscription</h2> You are currently subscribed to Broadstreet's Adserver, giving your site stress-free adserving, and click/view reporting. You can cancel this subscription here. Canceling will revert your ads to start serving from your site instead of an adserver. <form method="post"> <input style="background-color: red; color: white;" type="submit" name="cancel" value="Cancel Adserving Subscription"> </form> <?php } ?> <?php if (!Broadstreet_Adwidget_Mini_Utility::hasAdserving() && Broadstreet_Adwidget_Mini_Utility::hasNetwork()) { ?> <h2>Adserver Subscription</h2> You were once subscribed to Broadstreet's Adserver, giving your site stress-free adserving, and click/view reporting. You can re-enable your subscription here. Changes will be immediate. <form method="post"> <input style="background-color: green; color: white;" type="submit" name="subscribe" value="Subscribe me for $5 / month"> </form> <?php } ?>
/** * Import old adwidget ads to Broadstreet ads * @param string $email */ public static function importOldAds($email = false) { $api = new Broadstreet(); try { if (!Broadstreet_Adwidget_Mini_Utility::hasNetwork()) { # Register the user by email address $user = $api->register($email); Broadstreet_Adwidget_Mini_Utility::setOption(Broadstreet_Adwidget_Mini_Utility::KEY_API_KEY, $user->access_token); # Create a network for the new user # Don't change this unless you want a higher tier. There's no lower tier, you haxor you $net = $api->createNetwork('Wordpress - ' . get_bloginfo('name'), array('tier_id' => 4)); Broadstreet_Adwidget_Mini_Utility::setOption(Broadstreet_Adwidget_Mini_Utility::KEY_NETWORK_ID, $net->id); } else { $api = self::getClient(); $net = (object) array('id' => Broadstreet_Adwidget_Mini_Utility::getNetworkID()); } /* Import Image widgets */ $ads = Broadstreet_Adwidget_Mini_Utility::getOption('widget_adwidget_imagewidget'); foreach ($ads as $id => $data) { /* Ad already imported? Skip it */ if (!is_numeric($id) || is_numeric(@$data['bs_ad_id'])) { continue; } $adv = $api->createAdvertiser($net->id, self::arrayGet($data, 'w_adv', 'New Advertiser - Image')); Broadstreet_Adwidget_Mini_Utility::setOption(Broadstreet_Adwidget_Mini_Utility::KEY_ADVERTISER_ID, $adv->id); $ad = self::importImageAd($net->id, $adv->id, $data['w_img'], $data['w_link']); if (!$ad) { continue; } $ads[$id]['bs_ad_html'] = $ad->html; $ads[$id]['bs_ad_id'] = $ad->id; $ads[$id]['bs_adv_id'] = $adv->id; } Broadstreet_Adwidget_Mini_Utility::setOption('widget_adwidget_imagewidget', $ads); /* Import HTML widgets */ $ads = Broadstreet_Adwidget_Mini_Utility::getOption('widget_adwidget_htmlwidget'); foreach ($ads as $id => $data) { /* Ad already imported? Skip it */ if (!is_numeric($id) || is_numeric(@$data['bs_ad_id'])) { continue; } $adv = $api->createAdvertiser($net->id, self::arrayGet($data, 'w_adv', 'New Advertiser - HTML')); Broadstreet_Adwidget_Mini_Utility::setOption(Broadstreet_Adwidget_Mini_Utility::KEY_ADVERTISER_ID, $adv->id); $ad = self::importHTMLAd($net->id, $adv->id, $data['w_adcode']); if (!$ad) { continue; } $ads[$id]['bs_ad_html'] = $ad->html; $ads[$id]['bs_ad_id'] = $ad->id; $ads[$id]['bs_adv_id'] = $adv->id; } Broadstreet_Adwidget_Mini_Utility::setOption('widget_adwidget_htmlwidget', $ads); } catch (Exception $ex) { self::sendReport($ex->__toString()); return false; } return true; }