WordPress Ad Widget - Version 2.1.2

Version Description

Download this release

Release Info

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

Code changes from version 2.1.0 to 2.1.2

Files changed (3) hide show
  1. adwidget.php +88 -2
  2. readme.txt +6 -4
  3. views/admin.php +14 -0
adwidget.php CHANGED
@@ -3,7 +3,7 @@
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.0
7
Author: Broadstreet Ads
8
Author URI: http://broadstreetads.com
9
*/
@@ -17,6 +17,9 @@ add_action('admin_menu', array('AdWidget_Core', 'registerAdmin'));
17
*/
18
class AdWidget_Core
19
{
20
/**
21
* The callback used to register the scripts
22
*/
@@ -46,7 +49,7 @@ class AdWidget_Core
46
*/
47
public static function getBaseURL()
48
{
49
- return (get_bloginfo('url') . '/wp-content/plugins/adwidget/');
50
}
51
52
/**
@@ -62,8 +65,91 @@ class AdWidget_Core
62
*/
63
static function adminMenuCallback()
64
{
65
include dirname(__FILE__) . '/views/admin.php';
66
}
67
}
68
69
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.2
7
Author: Broadstreet Ads
8
Author URI: http://broadstreetads.com
9
*/
17
*/
18
class AdWidget_Core
19
{
20
+ CONST KEY_INSTALL_REPORT = 'AdWidget_Installed';
21
+ CONST VERSION = '2.1.2';
22
+
23
/**
24
* The callback used to register the scripts
25
*/
49
*/
50
public static function getBaseURL()
51
{
52
+ return (get_bloginfo('url') . '/wp-content/plugins/ad-widget/');
53
}
54
55
/**
65
*/
66
static function adminMenuCallback()
67
{
68
+ self::sendInstallReportIfNew();
69
include dirname(__FILE__) . '/views/admin.php';
70
}
71
+
72
+ /**
73
+ * Makes a call to the Broadstreet service to collect information information
74
+ * on the blog in case of errors and other needs.
75
+ */
76
+ public static function sendReport($message = 'General')
77
+ {
78
+
79
+ $report = "$message\n";
80
+ $report .= get_bloginfo('name'). "\n";
81
+ $report .= get_bloginfo('url'). "\n";
82
+ $report .= get_bloginfo('admin_email'). "\n";
83
+ $report .= 'WP Version: ' . get_bloginfo('version'). "\n";
84
+ $report .= 'Plugin Version: ' . self::VERSION . "\n";
85
+ $report .= "$message\n";
86
+
87
+ @wp_mail('plugin@broadstreetads.com', "Report: $message", $report);
88
+ }
89
+
90
+ /**
91
+ * If this is a new installation and we've never sent a report to the
92
+ * Broadstreet server, send a packet of basic info about this blog in case
93
+ * issues should arise in the future.
94
+ */
95
+ public static function sendInstallReportIfNew()
96
+ {
97
+ $install_key = self::KEY_INSTALL_REPORT;
98
+ $upgrade_key = self::KEY_INSTALL_REPORT .'_'. self::VERSION;
99
+
100
+ $installed = self::getOption($install_key);
101
+ $upgraded = self::getOption($upgrade_key);
102
+
103
+ $sent = ($installed && $upgraded);
104
+
105
+ if($sent === FALSE)
106
+ {
107
+ if(!$installed)
108
+ {
109
+ self::sendReport("Installation");
110
+ self::setOption($install_key, 'true');
111
+ self::setOption($upgrade_key, 'true');
112
+ }
113
+ else
114
+ {
115
+ self::flushRewrites(true);
116
+ self::sendReport("Upgrade");
117
+ self::setOption($upgrade_key, 'true');
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Sets a Wordpress option
124
+ * @param string $name The name of the option to set
125
+ * @param string $value The value of the option to set
126
+ */
127
+ public static function setOption($name, $value)
128
+ {
129
+ if (get_option($name) !== FALSE)
130
+ {
131
+ update_option($name, $value);
132
+ }
133
+ else
134
+ {
135
+ $deprecated = ' ';
136
+ $autoload = 'no';
137
+ add_option($name, $value, $deprecated, $autoload);
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Gets a Wordpress option
143
+ * @param string $name The name of the option
144
+ * @param mixed $default The default value to return if one doesn't exist
145
+ * @return string The value if the option does exist
146
+ */
147
+ public static function getOption($name, $default = FALSE)
148
+ {
149
+ $value = get_option($name);
150
+ if( $value !== FALSE ) return $value;
151
+ return $default;
152
+ }
153
}
154
155
readme.txt CHANGED
@@ -3,10 +3,10 @@ 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.0
7
8
- This is a Wordpress plugin that will list your open source projects from
9
- github or bitbucket in-page or via sidebar.
10
11
== Description ==
12
@@ -20,6 +20,8 @@ to the sidebar, upload, an ad, and save.
20
21
You will not find an easier way to run ads on your website!
22
23
== Demo ==
24
25
Watch a short video demo: http://www.screenr.com/u0t7
@@ -29,4 +31,4 @@ Watch a short video demo: http://www.screenr.com/u0t7
29
There aren't any special instructions for installing this plug-in. Once
30
installed, go to Appearance -> Widgets, and look for the "Ad Widget" widgets!
31
32
- You can also go to Settings -> Ad Widget for a video demo on how to use it.
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.2
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.
10
11
== Description ==
12
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
31
There aren't any special instructions for installing this plug-in. Once
32
installed, go to Appearance -> Widgets, and look for the "Ad Widget" widgets!
33
34
+ You can also go to Settings -> Ad Widget for a video demo on how to use it.
views/admin.php CHANGED
@@ -1,4 +1,12 @@
1
<div style="width: 650px;">
2
3
<h1>Wordpress Ad Widget</h1>
4
@@ -23,6 +31,12 @@ Drag one of those into your a widget area, like a sidebar, and follow the
23
instructions! Send questions to kenny@broadstreetads.com .
24
</p>
25
26
<p>
27
Here's a short instructional video if you need help:
28
</p>
1
<div style="width: 650px;">
2
+ <script>(function(d, s, id) {
3
+ var js, fjs = d.getElementsByTagName(s)[0];
4
+ if (d.getElementById(id)) return;
5
+ js = d.createElement(s); js.id = id;
6
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=313569238757581";
7
+ fjs.parentNode.insertBefore(js, fjs);
8
+ }(document, 'script', 'facebook-jssdk'));</script>
9
+ <script>window.admin_email = '<?php bloginfo('admin_email'); ?>';</script>
10
11
<h1>Wordpress Ad Widget</h1>
12
31
instructions! Send questions to kenny@broadstreetads.com .
32
</p>
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
<p>
41
Here's a short instructional video if you need help:
42
</p>