Version Description
Download this release
Release Info
Developer | redwallhp |
Plugin | WP125 |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- adminmenus.php +338 -339
- installer.php +0 -2
- readme.txt +3 -2
- uninstall.php +0 -1
- widget_class.php +14 -4
- wp125.php +2 -1
adminmenus.php
CHANGED
@@ -17,358 +17,357 @@ if (function_exists('wp_enqueue_style')) {
|
|
17 |
|
18 |
//Write Manage Menu
|
19 |
function wp125_write_managemenu() {
|
20 |
-
echo '<div class="wrap">
|
21 |
-
<h2>'.__('Manage Ads', 'wp125').'</h2>';
|
22 |
|
23 |
-
//Handle deactivations
|
24 |
-
if ($_GET['wp125action'] == "deactivate") {
|
25 |
-
$theid = intval($_GET['theid']);
|
26 |
-
echo '<div id="message" class="updated fade"><p>'.__('Are you sure you want to deactivate the ad?', 'wp125').' <a href="admin.php?page=wp125/wp125.php&wp125action=deactivateconf&theid='.$theid.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125/wp125.php">'.__('No!', 'wp125').'</a></p></div>';
|
27 |
-
}
|
28 |
-
if ($_GET['wp125action'] == "deactivateconf") {
|
29 |
-
$theid = intval($_GET['theid']);
|
30 |
-
global $wpdb, $table_prefix;
|
31 |
-
$adtable_name = $wpdb->prefix . "wp125_ads";
|
32 |
-
$wpdb->update(
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
);
|
37 |
-
echo '<div id="message" class="updated fade"><p>'.__('Ad deactivated.', 'wp125').'</p></div>';
|
38 |
-
}
|
39 |
|
40 |
-
//Handle REactivations
|
41 |
-
if ($_GET['wp125action'] == "activate") {
|
42 |
-
$theid = intval($_GET['theid']);
|
43 |
-
echo '<div id="message" class="updated fade"><p>'.__('Are you sure you want to reactivate the ad?', 'wp125').' <a href="admin.php?page=wp125/wp125.php&showmanage=inactive&wp125action=activateconf&theid='.$theid.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125/wp125.php&showmanage=inactive">'.__('No!', 'wp125').'</a></p></div>';
|
44 |
-
}
|
45 |
-
if ($_GET['wp125action'] == "activateconf") {
|
46 |
-
$theid = intval($_GET['theid']);
|
47 |
-
global $wpdb, $table_prefix;
|
48 |
-
$adtable_name = $wpdb->prefix . "wp125_ads";
|
49 |
-
$wpdb->update(
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
);
|
54 |
-
echo '<div id="message" class="updated fade"><p>'.__('Ad activated.', 'wp125').'</p></div>';
|
55 |
-
}
|
56 |
|
57 |
-
echo '<ul class="subsubsub">'; ?>
|
58 |
-
<li><a href="admin.php?page=wp125/wp125.php" <?php if ($_GET['showmanage'] != 'inactive') { echo 'class="current"'; } ?>><?php _e('Active Ads', 'wp125'); ?></a> | </li><li><a href="admin.php?page=wp125/wp125.php&showmanage=inactive" <?php if ($_GET['showmanage'] == 'inactive') { echo 'class="current"'; } ?>><?php _e('Inactive Ads', 'wp125'); ?></a></li>
|
59 |
-
<?php echo '</ul>
|
60 |
-
<table class="widefat">
|
61 |
-
<thead><tr>
|
62 |
-
<th scope="col">'.__('Slot', 'wp125').'</th>
|
63 |
-
<th scope="col">'.__('Name', 'wp125').'</th>
|
64 |
-
<th scope="col" class="num">'.__('Clicks', 'wp125').'</th>
|
65 |
-
<th scope="col">'.__('Start Date', 'wp125').'</th>
|
66 |
-
<th scope="col">'.__('End Date', 'wp125').'</th>
|
67 |
-
<th scope="col"></th>
|
68 |
-
<th scope="col" style="text-align:right;"><a href="admin.php?page=wp125_addedit" class="button rbutton">'.__('Add New', 'wp125').'</a></th>
|
69 |
-
</tr></thead>
|
70 |
-
<tbody>';
|
71 |
-
|
72 |
-
global $wpdb;
|
73 |
-
$adtable_name = $wpdb->prefix . "wp125_ads";
|
74 |
-
if ($_GET['showmanage'] == 'inactive') {
|
75 |
-
$wp125db = $wpdb->get_results("SELECT * FROM $adtable_name WHERE status = '0' ORDER BY id DESC", OBJECT);
|
76 |
-
} else {
|
77 |
-
$wp125db = $wpdb->get_results("SELECT * FROM $adtable_name WHERE status != '0' ORDER BY id DESC", OBJECT);
|
78 |
-
}
|
79 |
-
if ($wp125db) {
|
80 |
-
foreach ($wp125db as $wp125db){
|
81 |
-
|
82 |
-
echo '<tr>';
|
83 |
-
echo '<td>'.$wp125db->slot.'</td>';
|
84 |
-
echo '<td><strong>'.$wp125db->name.'</strong></td>';
|
85 |
-
if ($wp125db->clicks!='-1') { echo '<td class="num">'.$wp125db->clicks.'</td>'; } else { echo '<td class="num">'.__('N/A', 'wp125').'</td>'; }
|
86 |
-
echo '<td>'.$wp125db->start_date.'</td>';
|
87 |
-
echo '<td>'.$wp125db->end_date.'</td>';
|
88 |
-
echo '<td><a href="admin.php?page=wp125_addedit&editad='.$wp125db->id.'">'.__('Edit', 'wp125').'</a></td>';
|
89 |
-
if ($_GET['showmanage'] == 'inactive') {
|
90 |
-
echo '<td><a href="admin.php?page=wp125/wp125.php&showmanage=inactive&wp125action=activate&theid='.$wp125db->id.'">'.__('Activate', 'wp125').'</a></td>';
|
91 |
-
} else {
|
92 |
-
echo '<td><a href="admin.php?page=wp125/wp125.php&wp125action=deactivate&theid='.$wp125db->id.'">'.__('Deactivate', 'wp125').'</a></td>';
|
93 |
-
}
|
94 |
-
echo '</tr>';
|
95 |
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
-
|
100 |
-
</
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
function wp125_write_addeditmenu() {
|
107 |
-
//DB Data
|
108 |
-
global $wpdb;
|
109 |
-
$adtable_name = $wpdb->prefix . "wp125_ads";
|
110 |
-
// Retrieve settings
|
111 |
-
$setting_ad_orientation = get_option("wp125_ad_orientation");
|
112 |
-
$setting_num_slots = get_option("wp125_num_slots");
|
113 |
-
$setting_ad_order = get_option("wp125_ad_order");
|
114 |
-
$setting_buyad_url = get_option("wp125_buyad_url");
|
115 |
-
$
|
116 |
-
$
|
117 |
-
$
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$
|
122 |
-
$
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
?><div class="wrap">
|
128 |
|
129 |
-
<?php
|
130 |
-
if ( $_POST['Submit'] && wp_verify_nonce($_POST['nonce_wp125_addedit'],'wp125_addedit') ) {
|
131 |
-
$post_editedad = $wpdb->escape($_POST['editedad']);
|
132 |
-
$post_adname = $wpdb->escape($_POST['adname']);
|
133 |
-
$post_adslot = $wpdb->escape($_POST['adslot']);
|
134 |
-
$post_adtarget = $wpdb->escape($_POST['adtarget']);
|
135 |
-
$post_adexp = $wpdb->escape($_POST['adexp']);
|
136 |
-
$post_adexpmo = $wpdb->escape($_POST['adexp-mo']);
|
137 |
-
$post_adexpday = $wpdb->escape($_POST['adexp-day']);
|
138 |
-
$post_adexpyr = $wpdb->escape($_POST['adexp-yr']);
|
139 |
-
$post_countclicks = $wpdb->escape($_POST['countclicks']);
|
140 |
-
$post_adimage = $wpdb->escape($_POST['adimage']);
|
141 |
-
if ($post_countclicks=='on') { $post_countclicks = '0'; } else { $post_countclicks = '-1'; }
|
142 |
-
$today = date('m').'/'.date('d').'/'.date('Y');
|
143 |
-
if ($post_adexp=='manual') { $theenddate = '00/00/0000'; }
|
144 |
-
if ($post_adexp=='other') { $theenddate = $post_adexpmo.'/'.$post_adexpday.'/'.$post_adexpyr; }
|
145 |
-
if ($post_adexp=='30') { $expiry = time() + 30 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
146 |
-
if ($post_adexp=='60') { $expiry = time() + 60 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
147 |
-
if ($post_adexp=='90') { $expiry = time() + 90 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
148 |
-
if ($post_adexp=='120') { $expiry = time() + 120 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
149 |
-
if ($post_editedad!='') { $theenddate = $post_adexpmo.'/'.$post_adexpday.'/'.$post_adexpyr; }
|
150 |
-
if ($post_editedad=='') {
|
151 |
-
$updatedb = "INSERT INTO $adtable_name (slot, name, start_date, end_date, clicks, status, target, image_url, pre_exp_email) VALUES ('$post_adslot', '$post_adname', '$today','$theenddate','$post_countclicks', '1', '$post_adtarget','$post_adimage', '0')";
|
152 |
-
$results = $wpdb->query($updatedb);
|
153 |
-
echo '<div id="message" class="updated fade"><p>Ad "'.$post_adname.'" created.</p></div>';
|
154 |
-
} else {
|
155 |
-
$updatedb = "UPDATE $adtable_name SET slot = '$post_adslot', name = '$post_adname', end_date = '$theenddate', target = '$post_adtarget', image_url = '$post_adimage', pre_exp_email = '0' WHERE id='$post_editedad'";
|
156 |
-
$results = $wpdb->query($updatedb);
|
157 |
-
echo '<div id="message" class="updated fade"><p>'.__('Ad', 'wp125').' "'.$post_adname.'" '.__('updated.', 'wp125').'</p></div>';
|
158 |
-
}
|
159 |
-
}
|
160 |
-
if ($_POST['deletead']) {
|
161 |
-
$post_editedad = $wpdb->escape($_POST['editedad']);
|
162 |
-
echo '<div id="message" class="updated fade"><p>'.__('Do you really want to delete this ad record? This action cannot be undone.', 'wp125').' <a href="admin.php?page=wp125_addedit&deletead='.$post_editedad.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125_addedit&editad='.$post_editedad.'">'.__('No!', 'wp125').'</a></p></div>';
|
163 |
-
}
|
164 |
-
if ($_GET['deletead']!='') {
|
165 |
-
$thead = intval($_GET['deletead']);
|
166 |
-
$updatedb = "DELETE FROM $adtable_name WHERE id='$thead'";
|
167 |
-
$results = $wpdb->query($updatedb);
|
168 |
-
echo '<div id="message" class="updated fade"><p>'.__('Ad deleted.', 'wp125').'</p></div>';
|
169 |
-
}
|
170 |
-
?>
|
171 |
-
|
172 |
-
<h2><?php _e('Add/Edit Ads', 'wp125'); ?></h2>
|
173 |
-
|
174 |
-
<form method="post" action="admin.php?page=wp125_addedit">
|
175 |
-
<?php wp_nonce_field('wp125_addedit', 'nonce_wp125_addedit'); ?>
|
176 |
-
<table class="form-table">
|
177 |
-
|
178 |
-
<?php if ($_GET['editad']!='') { echo '<input name="editedad" type="hidden" value="'.intval($_GET['editad']).'" />'; } ?>
|
179 |
-
|
180 |
-
<tr valign="top">
|
181 |
-
<th scope="row"><?php _e('Name', 'wp125'); ?></th>
|
182 |
-
<td><input name="adname" type="text" id="adname" value="<?php echo $editingad->name; ?>" size="40" /><br/><?php _e('Whose ad is this?', 'wp125'); ?></td>
|
183 |
-
</tr>
|
184 |
-
|
185 |
-
<tr valign="top">
|
186 |
-
<th scope="row"><?php _e('Slot', 'wp125'); ?></th>
|
187 |
-
<td><label for="adslot">
|
188 |
-
<select name="adslot" id="adslot">
|
189 |
-
<?php for ($count = 1; $count <= $setting_num_slots; $count += 1) { ?>
|
190 |
-
<option value="<?php echo $count; ?>" <?php if ($count == $editingad->slot) { echo 'selected="selected"'; } ?>>#<?php echo $count; ?></option>
|
191 |
-
<?php } ?>
|
192 |
-
</select></label>
|
193 |
-
</td></tr>
|
194 |
-
|
195 |
-
<tr valign="top">
|
196 |
-
<th scope="row"><?php _e('Target URL', 'wp125'); ?></th>
|
197 |
-
<td><input name="adtarget" type="text" id="adtarget" value="<?php if ($editingad->target!='') { echo $editingad->target; } else { echo 'http://'; } ?>" size="40" /><br/><?php _e('Where should the ad link to?', 'wp125'); ?></td>
|
198 |
-
</tr>
|
199 |
-
|
200 |
-
<?php if ($_GET['editad']!='') {
|
201 |
-
$enddate = $editingad->end_date;
|
202 |
-
if ($enddate != '00/00/0000') {
|
203 |
-
$enddate = strtotime($enddate);
|
204 |
-
$endmonth = date('m', $enddate);
|
205 |
-
$endday = date('d', $enddate);
|
206 |
-
$endyear = date('Y', $enddate);
|
207 |
-
} else { $endmonth='00'; $endday='00'; $endyear='0000'; }
|
208 |
-
} ?>
|
209 |
-
<tr valign="top">
|
210 |
-
<th scope="row"><?php _e('Expiration', 'wp125'); ?></th>
|
211 |
-
<td><label for="adexp">
|
212 |
-
<?php if ($_GET['editad']=='') { ?><select name="adexp" id="adexp" onChange="isOtherDate(this.value)">
|
213 |
-
<option value="manual"><?php _e("I'll remove it manually", 'wp125'); ?></option>
|
214 |
-
<option selected="selected" value="30">30 <?php _e('Days', 'wp125'); ?></option>
|
215 |
-
<option value="60">60 <?php _e('Days', 'wp125'); ?></option>
|
216 |
-
<option value="90">90 <?php _e('Days', 'wp125'); ?></option>
|
217 |
-
<option value="120">120 <?php _e('Days', 'wp125'); ?></option>
|
218 |
-
<option value="other"><?php _e('Other', 'wp125'); ?></option>
|
219 |
-
</select><?php } ?></label>
|
220 |
-
<span id="adexp-date"> <?php _e('Month:', 'wp125'); ?> <input type="text" name="adexp-mo" id="adexp-mo" size="2" value="<?php if ($endmonth!='') { echo $endmonth; } else { echo date('m'); } ?>" /> <?php _e('Day:', 'wp125'); ?> <input type="text" name="adexp-day" id="adexp-day" size="2" value="<?php if ($endday!='') { echo $endday; } else { echo date('d'); } ?>" /> <?php _e('Year:', 'wp125'); ?> <input type="text" name="adexp-yr" id="adexp-yr" size="4" value="<?php if ($endyear!='') { echo $endyear; } else { echo date('Y'); } ?>" /> <?php if ($_GET['editad']!='') { ?><br /> <?php _e('Use 00/00/0000 for manual removal.', 'wp125'); ?><?php } ?></span>
|
221 |
-
</td></tr>
|
222 |
-
|
223 |
-
<?php if ($_GET['editad']=='') { ?><script type="text/javascript">
|
224 |
-
document.getElementById("adexp-date").style.display = "none";
|
225 |
-
function isOtherDate(obj) {
|
226 |
-
if (obj=="other") {
|
227 |
-
document.getElementById("adexp-date").style.display = "inline";
|
228 |
-
} else {
|
229 |
-
document.getElementById("adexp-date").style.display = "none";
|
230 |
-
}
|
231 |
-
}
|
232 |
-
</script><?php } ?>
|
233 |
-
|
234 |
-
<?php if ($_GET['editad']=='') { ?>
|
235 |
-
<tr valign="top">
|
236 |
-
<th scope="row"><?php _e('Click Tracking', 'wp125'); ?></th>
|
237 |
-
<td><input type="checkbox" name="countclicks" checked="checked" /> <?php _e('Count the number of times this ad is clicked', 'wp125'); ?></td>
|
238 |
-
</tr>
|
239 |
-
<?php } ?>
|
240 |
-
|
241 |
-
<tr valign="top">
|
242 |
-
<th scope="row"><?php _e('Ad Image', 'wp125'); ?></th>
|
243 |
-
<td><input name="adimage" type="text" id="adimage" value="<?php if ($editingad->image_url!='') { echo $editingad->image_url; } else { echo 'http://'; } ?>" size="40" /> <input id="upload_image_button" type="button" class="button" value="Upload Image" /></td>
|
244 |
-
</tr>
|
245 |
-
|
246 |
-
<script type="text/javascript">
|
247 |
-
jQuery(document).ready(function() {
|
248 |
-
jQuery('#upload_image_button').click(function() {
|
249 |
-
formfield = jQuery('#adimage').attr('name');
|
250 |
-
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
|
251 |
-
return false;
|
252 |
-
});
|
253 |
-
|
254 |
-
window.send_to_editor = function(html) {
|
255 |
-
imgurl = jQuery('img',html).attr('src');
|
256 |
-
jQuery('#adimage').val(imgurl);
|
257 |
-
tb_remove();
|
258 |
}
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
<
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
268 |
|
269 |
function wp125_write_settingsmenu() {
|
270 |
-
//DB Data
|
271 |
-
global $wpdb;
|
272 |
-
//Add settings, if submitted
|
273 |
-
if ($_POST['issubmitted']=='yes') {
|
274 |
-
$post_adorient = $wpdb->escape($_POST['adorient']);
|
275 |
-
$post_numslots = $wpdb->escape($_POST['numads']);
|
276 |
-
$post_adorder = $wpdb->escape($_POST['adorder']);
|
277 |
-
$post_salespage = $wpdb->escape($_POST['salespage']);
|
278 |
-
$post_widgettitle = $wpdb->escape($_POST['widgettitle']);
|
279 |
-
$post_defaultstyle = $wpdb->escape($_POST['defaultstyle']);
|
280 |
-
$post_emailonexp = $wpdb->escape($_POST['emailonexp']);
|
281 |
-
$post_daysbeforeexp = $wpdb->escape($_POST['daysbeforeexp']);
|
282 |
-
$post_defaultad = $wpdb->escape($_POST['defaultad']);
|
283 |
-
if ($post_defaultstyle!='on') { $post_defaultstyle = 'yes'; } else { $post_defaultstyle = ''; }
|
284 |
-
update_option("wp125_ad_orientation", $post_adorient);
|
285 |
-
update_option("wp125_num_slots", $post_numslots);
|
286 |
-
update_option("wp125_ad_order", $post_adorder);
|
287 |
-
update_option("wp125_buyad_url", $post_salespage);
|
288 |
-
update_option("
|
289 |
-
update_option("
|
290 |
-
update_option("
|
291 |
-
update_option("
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
$
|
297 |
-
$
|
298 |
-
$
|
299 |
-
$
|
300 |
-
$
|
301 |
-
$
|
302 |
-
$
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
<
|
307 |
-
<
|
308 |
-
|
309 |
-
|
310 |
-
<
|
311 |
-
<
|
312 |
-
<
|
313 |
-
<
|
314 |
-
<option <?php if ($setting_ad_orientation=='
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
<
|
321 |
-
<
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
<
|
326 |
-
<
|
327 |
-
<
|
328 |
-
<
|
329 |
-
<option
|
330 |
-
|
331 |
-
</
|
332 |
-
</
|
333 |
-
|
334 |
-
<tr valign="top">
|
335 |
-
<th scope="row"><?php _e('Widget Title', 'wp125'); ?></th>
|
336 |
-
<td><input name="widgettitle" type="text" id="widgettitle" value="<?php echo $setting_widget_title; ?>" size="50" /><br/><?php _e('The title to be displayed in the widget.', 'wp125'); ?> <em><?php _e('(Leave blank to disable.)', 'wp125'); ?></em></td>
|
337 |
-
</tr>
|
338 |
-
|
339 |
-
<tr valign="top">
|
340 |
-
<th scope="row"><?php _e('Ad Sales Page', 'wp125'); ?></th>
|
341 |
-
<td><input name="salespage" type="text" id="salespage" value="<?php echo $setting_buyad_url; ?>" size="50" /><br/><?php _e('Do you have a page with statistics and prices?', 'wp125'); ?> <em><?php _e('(Default Ads will link here.)', 'wp125'); ?></em></td>
|
342 |
-
</tr>
|
343 |
-
|
344 |
-
<tr valign="top">
|
345 |
-
<th scope="row"><?php _e('Default Style', 'wp125'); ?></th>
|
346 |
-
<td><input type="checkbox" name="defaultstyle" <?php if ($setting_disable_default_style=='') { echo 'checked="checked"'; } ?> /> <?php _e('Include default ad stylesheet?', 'wp125'); ?> <br/><?php _e('Leave checked unless you want to use your own CSS to style the ads. Refer to the documentation for further help.', 'wp125'); ?></td>
|
347 |
-
</tr>
|
348 |
-
|
349 |
-
<tr valign="top">
|
350 |
-
<th scope="row"><?php _e('Expiration Email', 'wp125'); ?></th>
|
351 |
-
<td><input name="emailonexp" type="text" id="emailonexp" value="<?php echo $setting_emailonexp; ?>" size="50" /><br/><?php _e('Enter your email address if you would like to be emailed when an ad expires.', 'wp125'); ?> <em><?php _e('(Leave blank to disable.)', 'wp125'); ?></em></td>
|
352 |
-
</tr>
|
353 |
-
|
354 |
-
<tr valign="top">
|
355 |
-
<th scope="row"><?php _e('Pre-Expiration Email', 'wp125'); ?></th>
|
356 |
-
<td><?php _e('Remind me', 'wp125'); ?> <input name="daysbeforeexp" type="text" id="daysbeforeexp" value="<?php echo $setting_daysbeforeexp; ?>" size="2" /> <?php _e('days before an ad expires.', 'wp125'); ?> <em><?php _e('(Emails will be sent to the address specified above.)', 'wp125'); ?></em></td>
|
357 |
-
</tr>
|
358 |
-
|
359 |
-
<tr valign="top">
|
360 |
-
<th scope="row"><?php _e('Default Ad', 'wp125'); ?></th>
|
361 |
-
<td><input name="defaultad" type="text" id="defaultad" value="<?php echo $setting_defaultad; ?>" size="50" /><br/><?php _e('Which image should be shown as a placeholder when an ad slot is empty?', 'wp125'); ?> (<a href="<?php echo wp125_get_plugin_dir('url').'/youradhere.jpg'; ?>"><?php _e('Default', 'wp125'); ?></a>)</td>
|
362 |
-
</tr>
|
363 |
-
|
364 |
-
</table>
|
365 |
-
<input name="issubmitted" type="hidden" value="yes" />
|
366 |
-
<p class="submit"><input type="submit" class="button" name="Submit" value="<?php _e('Save Changes', 'wp125'); ?>" /></p>
|
367 |
-
</form>
|
368 |
-
<br/>
|
369 |
-
<p><?php _e("Your ads can be displayed using either the included widget, or by using the <strong><?php wp125_write_ads(); ?></strong> template tag. Also, you can display a single ad, without any formatting, using <strong><?php wp125_single_ad(<em>num</em>); ?></strong>, where <em>num</em> is the number of the ad slot you wish to show. This is useful for cases where your theme prevents the default formatting from working properly, or where you wish to display your ads in an unforeseen manner.", 'wp125'); ?></p>
|
370 |
-
<?php wp125_admin_page_footer(); ?>
|
371 |
-
</div><?php
|
372 |
}
|
373 |
|
374 |
|
17 |
|
18 |
//Write Manage Menu
|
19 |
function wp125_write_managemenu() {
|
20 |
+
echo '<div class="wrap">
|
21 |
+
<h2>'.__('Manage Ads', 'wp125').'</h2>';
|
22 |
|
23 |
+
//Handle deactivations
|
24 |
+
if ($_GET['wp125action'] == "deactivate") {
|
25 |
+
$theid = intval($_GET['theid']);
|
26 |
+
echo '<div id="message" class="updated fade"><p>'.__('Are you sure you want to deactivate the ad?', 'wp125').' <a href="admin.php?page=wp125/wp125.php&wp125action=deactivateconf&theid='.$theid.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125/wp125.php">'.__('No!', 'wp125').'</a></p></div>';
|
27 |
+
}
|
28 |
+
if ($_GET['wp125action'] == "deactivateconf") {
|
29 |
+
$theid = intval($_GET['theid']);
|
30 |
+
global $wpdb, $table_prefix;
|
31 |
+
$adtable_name = $wpdb->prefix . "wp125_ads";
|
32 |
+
$wpdb->update(
|
33 |
+
$adtable_name,
|
34 |
+
array('status' => '0'),
|
35 |
+
array('id' => $theid)
|
36 |
+
);
|
37 |
+
echo '<div id="message" class="updated fade"><p>'.__('Ad deactivated.', 'wp125').'</p></div>';
|
38 |
+
}
|
39 |
|
40 |
+
//Handle REactivations
|
41 |
+
if ($_GET['wp125action'] == "activate") {
|
42 |
+
$theid = intval($_GET['theid']);
|
43 |
+
echo '<div id="message" class="updated fade"><p>'.__('Are you sure you want to reactivate the ad?', 'wp125').' <a href="admin.php?page=wp125/wp125.php&showmanage=inactive&wp125action=activateconf&theid='.$theid.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125/wp125.php&showmanage=inactive">'.__('No!', 'wp125').'</a></p></div>';
|
44 |
+
}
|
45 |
+
if ($_GET['wp125action'] == "activateconf") {
|
46 |
+
$theid = intval($_GET['theid']);
|
47 |
+
global $wpdb, $table_prefix;
|
48 |
+
$adtable_name = $wpdb->prefix . "wp125_ads";
|
49 |
+
$wpdb->update(
|
50 |
+
$adtable_name,
|
51 |
+
array('status' => '1', 'pre_exp_email' => '0'),
|
52 |
+
array('id' => $theid)
|
53 |
+
);
|
54 |
+
echo '<div id="message" class="updated fade"><p>'.__('Ad activated.', 'wp125').'</p></div>';
|
55 |
+
}
|
56 |
|
57 |
+
echo '<ul class="subsubsub">'; ?>
|
58 |
+
<li><a href="admin.php?page=wp125/wp125.php" <?php if ($_GET['showmanage'] != 'inactive') { echo 'class="current"'; } ?>><?php _e('Active Ads', 'wp125'); ?></a> | </li><li><a href="admin.php?page=wp125/wp125.php&showmanage=inactive" <?php if ($_GET['showmanage'] == 'inactive') { echo 'class="current"'; } ?>><?php _e('Inactive Ads', 'wp125'); ?></a></li>
|
59 |
+
<?php echo '</ul>
|
60 |
+
<table class="widefat">
|
61 |
+
<thead><tr>
|
62 |
+
<th scope="col">'.__('Slot', 'wp125').'</th>
|
63 |
+
<th scope="col">'.__('Name', 'wp125').'</th>
|
64 |
+
<th scope="col" class="num">'.__('Clicks', 'wp125').'</th>
|
65 |
+
<th scope="col">'.__('Start Date', 'wp125').'</th>
|
66 |
+
<th scope="col">'.__('End Date', 'wp125').'</th>
|
67 |
+
<th scope="col"></th>
|
68 |
+
<th scope="col" style="text-align:right;"><a href="admin.php?page=wp125_addedit" class="button rbutton">'.__('Add New', 'wp125').'</a></th>
|
69 |
+
</tr></thead>
|
70 |
+
<tbody>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
global $wpdb;
|
73 |
+
$adtable_name = $wpdb->prefix . "wp125_ads";
|
74 |
+
if ($_GET['showmanage'] == 'inactive') {
|
75 |
+
$wp125db = $wpdb->get_results("SELECT * FROM $adtable_name WHERE status = '0' ORDER BY id DESC", OBJECT);
|
76 |
+
} else {
|
77 |
+
$wp125db = $wpdb->get_results("SELECT * FROM $adtable_name WHERE status != '0' ORDER BY id DESC", OBJECT);
|
78 |
+
}
|
79 |
+
if ($wp125db) {
|
80 |
+
foreach ($wp125db as $wp125db){
|
81 |
+
|
82 |
+
echo '<tr>';
|
83 |
+
echo '<td>'.$wp125db->slot.'</td>';
|
84 |
+
echo '<td><strong>'.$wp125db->name.'</strong></td>';
|
85 |
+
if ($wp125db->clicks!='-1') { echo '<td class="num">'.$wp125db->clicks.'</td>'; } else { echo '<td class="num">'.__('N/A', 'wp125').'</td>'; }
|
86 |
+
echo '<td>'.$wp125db->start_date.'</td>';
|
87 |
+
echo '<td>'.$wp125db->end_date.'</td>';
|
88 |
+
echo '<td><a href="admin.php?page=wp125_addedit&editad='.$wp125db->id.'">'.__('Edit', 'wp125').'</a></td>';
|
89 |
+
if ( isset($_GET['showmanage']) && ($_GET['showmanage'] == "inactive")) {
|
90 |
+
echo '<td><a href="admin.php?page=wp125/wp125.php&showmanage=inactive&wp125action=activate&theid='.$wp125db->id.'">'.__('Activate', 'wp125').'</a></td>';
|
91 |
+
} else {
|
92 |
+
echo '<td><a href="admin.php?page=wp125/wp125.php&wp125action=deactivate&theid='.$wp125db->id.'">'.__('Deactivate', 'wp125').'</a></td>';
|
93 |
+
}
|
94 |
+
echo '</tr>';
|
95 |
|
96 |
+
}
|
97 |
+
} else { echo '<tr> <td colspan="8">'.__('No ads found.', 'wp125').'</td> </tr>'; }
|
98 |
+
|
99 |
+
echo '</tbody>
|
100 |
+
</table>';
|
101 |
+
echo '<br /><a href="'.wp125_get_plugin_dir('url').'/calendar.php" title="Subscribe with your calendaring software..."><img src="'.wp125_get_plugin_dir('url').'/ical.gif" alt="iCalendar" /></a>';
|
102 |
+
wp125_admin_page_footer();
|
103 |
+
echo '</div>';
|
104 |
}
|
105 |
|
106 |
function wp125_write_addeditmenu() {
|
107 |
+
//DB Data
|
108 |
+
global $wpdb;
|
109 |
+
$adtable_name = $wpdb->prefix . "wp125_ads";
|
110 |
+
// Retrieve settings
|
111 |
+
$setting_ad_orientation = get_option("wp125_ad_orientation");
|
112 |
+
$setting_num_slots = get_option("wp125_num_slots");
|
113 |
+
$setting_ad_order = get_option("wp125_ad_order");
|
114 |
+
$setting_buyad_url = get_option("wp125_buyad_url");
|
115 |
+
$setting_disable_default_style = get_option("wp125_disable_default_style");
|
116 |
+
$setting_emailonexp = get_option("wp125_emailonexp");
|
117 |
+
$setting_defaultad = get_option("wp125_defaultad");
|
118 |
+
//If post is being edited, grab current info
|
119 |
+
if ($_GET['editad']!='') {
|
120 |
+
$theid = intval($_GET['editad']);
|
121 |
+
$editingad = $wpdb->get_row($wpdb->prepare(
|
122 |
+
"SELECT * FROM {$adtable_name} WHERE id = %d",
|
123 |
+
$theid
|
124 |
+
));
|
125 |
+
}
|
126 |
+
?><div class="wrap">
|
|
|
127 |
|
128 |
+
<?php
|
129 |
+
if ( $_POST['Submit'] && wp_verify_nonce($_POST['nonce_wp125_addedit'],'wp125_addedit') ) {
|
130 |
+
$post_editedad = $wpdb->escape($_POST['editedad']);
|
131 |
+
$post_adname = $wpdb->escape($_POST['adname']);
|
132 |
+
$post_adslot = $wpdb->escape($_POST['adslot']);
|
133 |
+
$post_adtarget = $wpdb->escape($_POST['adtarget']);
|
134 |
+
$post_adexp = $wpdb->escape($_POST['adexp']);
|
135 |
+
$post_adexpmo = $wpdb->escape($_POST['adexp-mo']);
|
136 |
+
$post_adexpday = $wpdb->escape($_POST['adexp-day']);
|
137 |
+
$post_adexpyr = $wpdb->escape($_POST['adexp-yr']);
|
138 |
+
$post_countclicks = $wpdb->escape($_POST['countclicks']);
|
139 |
+
$post_adimage = $wpdb->escape($_POST['adimage']);
|
140 |
+
if ($post_countclicks=='on') { $post_countclicks = '0'; } else { $post_countclicks = '-1'; }
|
141 |
+
$today = date('m').'/'.date('d').'/'.date('Y');
|
142 |
+
if ($post_adexp=='manual') { $theenddate = '00/00/0000'; }
|
143 |
+
if ($post_adexp=='other') { $theenddate = $post_adexpmo.'/'.$post_adexpday.'/'.$post_adexpyr; }
|
144 |
+
if ($post_adexp=='30') { $expiry = time() + 30 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
145 |
+
if ($post_adexp=='60') { $expiry = time() + 60 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
146 |
+
if ($post_adexp=='90') { $expiry = time() + 90 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
147 |
+
if ($post_adexp=='120') { $expiry = time() + 120 * 24 * 60 * 60; $expiry = strftime('%m/%d/%Y', $expiry); $theenddate = $expiry; }
|
148 |
+
if ($post_editedad!='') { $theenddate = $post_adexpmo.'/'.$post_adexpday.'/'.$post_adexpyr; }
|
149 |
+
if ($post_editedad=='') {
|
150 |
+
$updatedb = "INSERT INTO $adtable_name (slot, name, start_date, end_date, clicks, status, target, image_url, pre_exp_email) VALUES ('$post_adslot', '$post_adname', '$today','$theenddate','$post_countclicks', '1', '$post_adtarget','$post_adimage', '0')";
|
151 |
+
$results = $wpdb->query($updatedb);
|
152 |
+
echo '<div id="message" class="updated fade"><p>Ad "'.$post_adname.'" created.</p></div>';
|
153 |
+
} else {
|
154 |
+
$updatedb = "UPDATE $adtable_name SET slot = '$post_adslot', name = '$post_adname', end_date = '$theenddate', target = '$post_adtarget', image_url = '$post_adimage', pre_exp_email = '0' WHERE id='$post_editedad'";
|
155 |
+
$results = $wpdb->query($updatedb);
|
156 |
+
echo '<div id="message" class="updated fade"><p>'.__('Ad', 'wp125').' "'.$post_adname.'" '.__('updated.', 'wp125').'</p></div>';
|
157 |
+
}
|
158 |
+
}
|
159 |
+
if ($_POST['deletead']) {
|
160 |
+
$post_editedad = $wpdb->escape($_POST['editedad']);
|
161 |
+
echo '<div id="message" class="updated fade"><p>'.__('Do you really want to delete this ad record? This action cannot be undone.', 'wp125').' <a href="admin.php?page=wp125_addedit&deletead='.$post_editedad.'">'.__('Yes', 'wp125').'</a> <a href="admin.php?page=wp125_addedit&editad='.$post_editedad.'">'.__('No!', 'wp125').'</a></p></div>';
|
162 |
+
}
|
163 |
+
if ($_GET['deletead']!='') {
|
164 |
+
$thead = intval($_GET['deletead']);
|
165 |
+
$updatedb = "DELETE FROM $adtable_name WHERE id='$thead'";
|
166 |
+
$results = $wpdb->query($updatedb);
|
167 |
+
echo '<div id="message" class="updated fade"><p>'.__('Ad deleted.', 'wp125').'</p></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
+
?>
|
170 |
+
|
171 |
+
<h2><?php _e('Add/Edit Ads', 'wp125'); ?></h2>
|
172 |
+
|
173 |
+
<form method="post" action="admin.php?page=wp125_addedit">
|
174 |
+
<?php wp_nonce_field('wp125_addedit', 'nonce_wp125_addedit'); ?>
|
175 |
+
<table class="form-table">
|
176 |
+
|
177 |
+
<?php if (isset($_GET['editad']) && $_GET['editad']!='') { echo '<input name="editedad" type="hidden" value="'.intval($_GET['editad']).'" />'; } ?>
|
178 |
+
|
179 |
+
<tr valign="top">
|
180 |
+
<th scope="row"><?php _e('Name', 'wp125'); ?></th>
|
181 |
+
<td><input name="adname" type="text" id="adname" value="<?php echo $editingad->name; ?>" size="40" /><br/><?php _e('Whose ad is this?', 'wp125'); ?></td>
|
182 |
+
</tr>
|
183 |
+
|
184 |
+
<tr valign="top">
|
185 |
+
<th scope="row"><?php _e('Slot', 'wp125'); ?></th>
|
186 |
+
<td><label for="adslot">
|
187 |
+
<select name="adslot" id="adslot">
|
188 |
+
<?php for ($count = 1; $count <= $setting_num_slots; $count += 1) { ?>
|
189 |
+
<option value="<?php echo $count; ?>" <?php if ($count == $editingad->slot) { echo 'selected="selected"'; } ?>>#<?php echo $count; ?></option>
|
190 |
+
<?php } ?>
|
191 |
+
</select></label>
|
192 |
+
</td></tr>
|
193 |
+
|
194 |
+
<tr valign="top">
|
195 |
+
<th scope="row"><?php _e('Target URL', 'wp125'); ?></th>
|
196 |
+
<td><input name="adtarget" type="text" id="adtarget" value="<?php if (isset($editingad->target) && $editingad->target!='') { echo $editingad->target; } else { echo 'http://'; } ?>" size="40" /><br/><?php _e('Where should the ad link to?', 'wp125'); ?></td>
|
197 |
+
</tr>
|
198 |
+
|
199 |
+
<?php if (isset($_GET['editad']) && $_GET['editad']!='') {
|
200 |
+
$enddate = $editingad->end_date;
|
201 |
+
if ($enddate != '00/00/0000') {
|
202 |
+
$enddate = strtotime($enddate);
|
203 |
+
$endmonth = date('m', $enddate);
|
204 |
+
$endday = date('d', $enddate);
|
205 |
+
$endyear = date('Y', $enddate);
|
206 |
+
} else { $endmonth='00'; $endday='00'; $endyear='0000'; }
|
207 |
+
} ?>
|
208 |
+
<tr valign="top">
|
209 |
+
<th scope="row"><?php _e('Expiration', 'wp125'); ?></th>
|
210 |
+
<td><label for="adexp">
|
211 |
+
<?php if ($_GET['editad']=='') { ?><select name="adexp" id="adexp" onChange="isOtherDate(this.value)">
|
212 |
+
<option value="manual"><?php _e("I'll remove it manually", 'wp125'); ?></option>
|
213 |
+
<option selected="selected" value="30">30 <?php _e('Days', 'wp125'); ?></option>
|
214 |
+
<option value="60">60 <?php _e('Days', 'wp125'); ?></option>
|
215 |
+
<option value="90">90 <?php _e('Days', 'wp125'); ?></option>
|
216 |
+
<option value="120">120 <?php _e('Days', 'wp125'); ?></option>
|
217 |
+
<option value="other"><?php _e('Other', 'wp125'); ?></option>
|
218 |
+
</select><?php } ?></label>
|
219 |
+
<span id="adexp-date"> <?php _e('Month:', 'wp125'); ?> <input type="text" name="adexp-mo" id="adexp-mo" size="2" value="<?php if ($endmonth!='') { echo $endmonth; } else { echo date('m'); } ?>" /> <?php _e('Day:', 'wp125'); ?> <input type="text" name="adexp-day" id="adexp-day" size="2" value="<?php if ($endday!='') { echo $endday; } else { echo date('d'); } ?>" /> <?php _e('Year:', 'wp125'); ?> <input type="text" name="adexp-yr" id="adexp-yr" size="4" value="<?php if ($endyear!='') { echo $endyear; } else { echo date('Y'); } ?>" /> <?php if ($_GET['editad']!='') { ?><br /> <?php _e('Use 00/00/0000 for manual removal.', 'wp125'); ?><?php } ?></span>
|
220 |
+
</td></tr>
|
221 |
+
|
222 |
+
<?php if ($_GET['editad']=='') { ?><script type="text/javascript">
|
223 |
+
document.getElementById("adexp-date").style.display = "none";
|
224 |
+
function isOtherDate(obj) {
|
225 |
+
if (obj=="other") {
|
226 |
+
document.getElementById("adexp-date").style.display = "inline";
|
227 |
+
} else {
|
228 |
+
document.getElementById("adexp-date").style.display = "none";
|
229 |
+
}
|
230 |
+
}
|
231 |
+
</script><?php } ?>
|
232 |
+
|
233 |
+
<?php if ($_GET['editad']=='') { ?>
|
234 |
+
<tr valign="top">
|
235 |
+
<th scope="row"><?php _e('Click Tracking', 'wp125'); ?></th>
|
236 |
+
<td><input type="checkbox" name="countclicks" checked="checked" /> <?php _e('Count the number of times this ad is clicked', 'wp125'); ?></td>
|
237 |
+
</tr>
|
238 |
+
<?php } ?>
|
239 |
+
|
240 |
+
<tr valign="top">
|
241 |
+
<th scope="row"><?php _e('Ad Image', 'wp125'); ?></th>
|
242 |
+
<td><input name="adimage" type="text" id="adimage" value="<?php if ($editingad->image_url!='') { echo $editingad->image_url; } else { echo 'http://'; } ?>" size="40" /> <input id="upload_image_button" type="button" class="button" value="Upload Image" /></td>
|
243 |
+
</tr>
|
244 |
+
|
245 |
+
<script type="text/javascript">
|
246 |
+
jQuery(document).ready(function() {
|
247 |
+
jQuery('#upload_image_button').click(function() {
|
248 |
+
formfield = jQuery('#adimage').attr('name');
|
249 |
+
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
|
250 |
+
return false;
|
251 |
+
});
|
252 |
+
|
253 |
+
window.send_to_editor = function(html) {
|
254 |
+
imgurl = jQuery('img',html).attr('src');
|
255 |
+
jQuery('#adimage').val(imgurl);
|
256 |
+
tb_remove();
|
257 |
+
}
|
258 |
+
});
|
259 |
+
</script>
|
260 |
+
|
261 |
+
</table>
|
262 |
+
<p class="submit"><input type="submit" name="Submit" class="button" value="<?php _e('Save Ad', 'wp125'); ?>" /> <?php if ($_GET['editad']!='') { ?><input type="submit" name="deletead" value="<?php _e('Delete Ad', 'wp125'); ?>" /><?php } ?></p>
|
263 |
+
</form>
|
264 |
+
<?php wp125_admin_page_footer(); ?>
|
265 |
+
</div><?php
|
266 |
}
|
267 |
|
268 |
function wp125_write_settingsmenu() {
|
269 |
+
//DB Data
|
270 |
+
global $wpdb;
|
271 |
+
//Add settings, if submitted
|
272 |
+
if ($_POST['issubmitted']=='yes') {
|
273 |
+
$post_adorient = $wpdb->escape($_POST['adorient']);
|
274 |
+
$post_numslots = $wpdb->escape($_POST['numads']);
|
275 |
+
$post_adorder = $wpdb->escape($_POST['adorder']);
|
276 |
+
$post_salespage = $wpdb->escape($_POST['salespage']);
|
277 |
+
$post_widgettitle = $wpdb->escape($_POST['widgettitle']);
|
278 |
+
$post_defaultstyle = $wpdb->escape($_POST['defaultstyle']);
|
279 |
+
$post_emailonexp = $wpdb->escape($_POST['emailonexp']);
|
280 |
+
$post_daysbeforeexp = $wpdb->escape($_POST['daysbeforeexp']);
|
281 |
+
$post_defaultad = $wpdb->escape($_POST['defaultad']);
|
282 |
+
if ($post_defaultstyle!='on') { $post_defaultstyle = 'yes'; } else { $post_defaultstyle = ''; }
|
283 |
+
update_option("wp125_ad_orientation", $post_adorient);
|
284 |
+
update_option("wp125_num_slots", $post_numslots);
|
285 |
+
update_option("wp125_ad_order", $post_adorder);
|
286 |
+
update_option("wp125_buyad_url", $post_salespage);
|
287 |
+
update_option("wp125_disable_default_style", $post_defaultstyle);
|
288 |
+
update_option("wp125_emailonexp", $post_emailonexp);
|
289 |
+
update_option("wp125_daysbeforeexp", $post_daysbeforeexp);
|
290 |
+
update_option("wp125_defaultad", $post_defaultad);
|
291 |
+
echo '<div id="message" class="updated fade"><p>Settings updated.</p></div>';
|
292 |
+
}
|
293 |
+
//Retrieve settings
|
294 |
+
$setting_ad_orientation = get_option("wp125_ad_orientation");
|
295 |
+
$setting_num_slots = get_option("wp125_num_slots");
|
296 |
+
$setting_ad_order = get_option("wp125_ad_order");
|
297 |
+
$setting_buyad_url = get_option("wp125_buyad_url");
|
298 |
+
$setting_disable_default_style = get_option("wp125_disable_default_style");
|
299 |
+
$setting_emailonexp = get_option("wp125_emailonexp");
|
300 |
+
$setting_defaultad = get_option("wp125_defaultad");
|
301 |
+
$setting_daysbeforeexp = get_option("wp125_daysbeforeexp");
|
302 |
+
?>
|
303 |
+
<div class="wrap">
|
304 |
+
<h2><?php _e('Settings', 'wp125'); ?></h2>
|
305 |
+
<form method="post" action="admin.php?page=wp125_settings">
|
306 |
+
<table class="form-table">
|
307 |
+
|
308 |
+
<tr valign="top">
|
309 |
+
<th scope="row"><?php _e('Ad Orientation', 'wp125'); ?></th>
|
310 |
+
<td><label for="adorient">
|
311 |
+
<select name="adorient" id="adorient">
|
312 |
+
<option <?php if ($setting_ad_orientation=='1c') { echo 'selected="selected"'; } ?> value="1c"><?php _e('One Column', 'wp125'); ?></option>
|
313 |
+
<option <?php if ($setting_ad_orientation=='2c') { echo 'selected="selected"'; } ?> value="2c"><?php _e('Two Column', 'wp125'); ?></option>
|
314 |
+
</select></label>
|
315 |
+
<br/><?php _e('How many columns should the ads be displayed in?', 'wp125'); ?>
|
316 |
+
</td></tr>
|
317 |
+
|
318 |
+
<tr valign="top">
|
319 |
+
<th scope="row"><?php _e('Number of Ad Slots', 'wp125'); ?></th>
|
320 |
+
<td><input name="numads" type="text" id="numads" value="<?php echo $setting_num_slots; ?>" size="2" /><br/><?php _e('How many ads should be shown?', 'wp125'); ?></td>
|
321 |
+
</tr>
|
322 |
+
|
323 |
+
<tr valign="top">
|
324 |
+
<th scope="row"><?php _e('Ad Order', 'wp125'); ?></th>
|
325 |
+
<td><label for="adorder">
|
326 |
+
<select name="adorder" id="adorder">
|
327 |
+
<option selected="selected" value="normal" <?php if ($setting_ad_order=='normal') { echo 'selected="selected"'; } ?>><?php _e('Normal', 'wp125'); ?></option>
|
328 |
+
<option value="random" <?php if ($setting_ad_order=='random') { echo 'selected="selected"'; } ?>><?php _e('Random', 'wp125'); ?></option>
|
329 |
+
</select></label>
|
330 |
+
</td>
|
331 |
+
</tr>
|
332 |
+
|
333 |
+
<tr valign="top">
|
334 |
+
<th scope="row"><?php _e('Widget Title', 'wp125'); ?></th>
|
335 |
+
<td><input name="widgettitle" type="text" id="widgettitle" value="<?php echo $setting_widget_title; ?>" size="50" /><br/><?php _e('The title to be displayed in the widget.', 'wp125'); ?> <em><?php _e('(Leave blank to disable.)', 'wp125'); ?></em></td>
|
336 |
+
</tr>
|
337 |
+
|
338 |
+
<tr valign="top">
|
339 |
+
<th scope="row"><?php _e('Ad Sales Page', 'wp125'); ?></th>
|
340 |
+
<td><input name="salespage" type="text" id="salespage" value="<?php echo $setting_buyad_url; ?>" size="50" /><br/><?php _e('Do you have a page with statistics and prices?', 'wp125'); ?> <em><?php _e('(Default Ads will link here.)', 'wp125'); ?></em></td>
|
341 |
+
</tr>
|
342 |
+
|
343 |
+
<tr valign="top">
|
344 |
+
<th scope="row"><?php _e('Default Style', 'wp125'); ?></th>
|
345 |
+
<td><input type="checkbox" name="defaultstyle" <?php if ($setting_disable_default_style=='') { echo 'checked="checked"'; } ?> /> <?php _e('Include default ad stylesheet?', 'wp125'); ?> <br/><?php _e('Leave checked unless you want to use your own CSS to style the ads. Refer to the documentation for further help.', 'wp125'); ?></td>
|
346 |
+
</tr>
|
347 |
+
|
348 |
+
<tr valign="top">
|
349 |
+
<th scope="row"><?php _e('Expiration Email', 'wp125'); ?></th>
|
350 |
+
<td><input name="emailonexp" type="text" id="emailonexp" value="<?php echo $setting_emailonexp; ?>" size="50" /><br/><?php _e('Enter your email address if you would like to be emailed when an ad expires.', 'wp125'); ?> <em><?php _e('(Leave blank to disable.)', 'wp125'); ?></em></td>
|
351 |
+
</tr>
|
352 |
+
|
353 |
+
<tr valign="top">
|
354 |
+
<th scope="row"><?php _e('Pre-Expiration Email', 'wp125'); ?></th>
|
355 |
+
<td><?php _e('Remind me', 'wp125'); ?> <input name="daysbeforeexp" type="text" id="daysbeforeexp" value="<?php echo $setting_daysbeforeexp; ?>" size="2" /> <?php _e('days before an ad expires.', 'wp125'); ?> <em><?php _e('(Emails will be sent to the address specified above.)', 'wp125'); ?></em></td>
|
356 |
+
</tr>
|
357 |
+
|
358 |
+
<tr valign="top">
|
359 |
+
<th scope="row"><?php _e('Default Ad', 'wp125'); ?></th>
|
360 |
+
<td><input name="defaultad" type="text" id="defaultad" value="<?php echo $setting_defaultad; ?>" size="50" /><br/><?php _e('Which image should be shown as a placeholder when an ad slot is empty?', 'wp125'); ?> (<a href="<?php echo wp125_get_plugin_dir('url').'/youradhere.jpg'; ?>"><?php _e('Default', 'wp125'); ?></a>)</td>
|
361 |
+
</tr>
|
362 |
+
|
363 |
+
</table>
|
364 |
+
<input name="issubmitted" type="hidden" value="yes" />
|
365 |
+
<p class="submit"><input type="submit" class="button" name="Submit" value="<?php _e('Save Changes', 'wp125'); ?>" /></p>
|
366 |
+
</form>
|
367 |
+
<br/>
|
368 |
+
<p><?php _e("Your ads can be displayed using either the included widget, or by using the <strong><?php wp125_write_ads(); ?></strong> template tag. Also, you can display a single ad, without any formatting, using <strong><?php wp125_single_ad(<em>num</em>); ?></strong>, where <em>num</em> is the number of the ad slot you wish to show. This is useful for cases where your theme prevents the default formatting from working properly, or where you wish to display your ads in an unforeseen manner.", 'wp125'); ?></p>
|
369 |
+
<?php wp125_admin_page_footer(); ?>
|
370 |
+
</div><?php
|
371 |
}
|
372 |
|
373 |
|
installer.php
CHANGED
@@ -32,7 +32,6 @@ add_option("wp125_num_slots", "6");
|
|
32 |
add_option("wp125_ad_order", "normal");
|
33 |
add_option("wp125_buyad_url", "");
|
34 |
add_option("wp125_disable_default_style", "");
|
35 |
-
add_option("wp125_widget_title", "Ads");
|
36 |
add_option("wp125_dofollow", "");
|
37 |
add_option("wp125_emailonexp", get_option('admin_email'));
|
38 |
add_option("wp125_daysbeforeexp", "3");
|
@@ -64,7 +63,6 @@ add_option("wp125_num_slots", "6");
|
|
64 |
add_option("wp125_ad_order", "normal");
|
65 |
add_option("wp125_buyad_url", "");
|
66 |
add_option("wp125_disable_default_style", "");
|
67 |
-
add_option("wp125_widget_title", "Ads");
|
68 |
add_option("wp125_dofollow", "");
|
69 |
add_option("wp125_emailonexp", get_option('admin_email'));
|
70 |
add_option("wp125_daysbeforeexp", "3");
|
32 |
add_option("wp125_ad_order", "normal");
|
33 |
add_option("wp125_buyad_url", "");
|
34 |
add_option("wp125_disable_default_style", "");
|
|
|
35 |
add_option("wp125_dofollow", "");
|
36 |
add_option("wp125_emailonexp", get_option('admin_email'));
|
37 |
add_option("wp125_daysbeforeexp", "3");
|
63 |
add_option("wp125_ad_order", "normal");
|
64 |
add_option("wp125_buyad_url", "");
|
65 |
add_option("wp125_disable_default_style", "");
|
|
|
66 |
add_option("wp125_dofollow", "");
|
67 |
add_option("wp125_emailonexp", get_option('admin_email'));
|
68 |
add_option("wp125_daysbeforeexp", "3");
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ Author URI: http://www.webmaster-source.com
|
|
5 |
Donate link: http://www.webmaster-source.com/donate/?plugin=wp125
|
6 |
Tags: ads, 125x125, management, advertisement
|
7 |
Requires at least: 2.8
|
8 |
-
Tested up to: 3.
|
9 |
-
Stable tag: 1.5.
|
10 |
|
11 |
Easy management of 125x125 ads on your blog. Ads can be run for a specified number of days, and will automatically be taken down. Track clicks too.
|
12 |
|
@@ -136,3 +136,4 @@ If you're having a problem with the plugin, try posting on the official WordPres
|
|
136 |
* 1.5.0 - Fixed a potential CSRF vulnerability. (Minor security fix.)
|
137 |
* 1.5.1 - Added Czech translation.
|
138 |
* 1.5.3 - Added Ukrainian translation
|
|
5 |
Donate link: http://www.webmaster-source.com/donate/?plugin=wp125
|
6 |
Tags: ads, 125x125, management, advertisement
|
7 |
Requires at least: 2.8
|
8 |
+
Tested up to: 4.3.1
|
9 |
+
Stable tag: 1.5.4
|
10 |
|
11 |
Easy management of 125x125 ads on your blog. Ads can be run for a specified number of days, and will automatically be taken down. Track clicks too.
|
12 |
|
136 |
* 1.5.0 - Fixed a potential CSRF vulnerability. (Minor security fix.)
|
137 |
* 1.5.1 - Added Czech translation.
|
138 |
* 1.5.3 - Added Ukrainian translation
|
139 |
+
* 1.5.4 - Updated to support WordPress 4.3
|
uninstall.php
CHANGED
@@ -16,7 +16,6 @@ function wp125_uninstall() {
|
|
16 |
delete_option("wp125_ad_order");
|
17 |
delete_option("wp125_buyad_url");
|
18 |
delete_option("wp125_disable_default_style");
|
19 |
-
delete_option("wp125_widget_title");
|
20 |
delete_option("wp125_dofollow");
|
21 |
delete_option("wp125_emailonexp");
|
22 |
delete_option("wp125_daysbeforeexp");
|
16 |
delete_option("wp125_ad_order");
|
17 |
delete_option("wp125_buyad_url");
|
18 |
delete_option("wp125_disable_default_style");
|
|
|
19 |
delete_option("wp125_dofollow");
|
20 |
delete_option("wp125_emailonexp");
|
21 |
delete_option("wp125_daysbeforeexp");
|
widget_class.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
class WP125_Widget extends WP_Widget {
|
4 |
|
5 |
-
function
|
6 |
-
parent::
|
7 |
'wp125',
|
8 |
'WP125',
|
9 |
array( 'description' => 'Displays your ads' )
|
@@ -13,17 +13,27 @@ class WP125_Widget extends WP_Widget {
|
|
13 |
function widget($args, $instance) {
|
14 |
extract($args);
|
15 |
echo $before_widget;
|
16 |
-
if (
|
17 |
-
echo "\n".$before_title; echo
|
18 |
}
|
19 |
wp125_write_ads();
|
20 |
echo $after_widget;
|
21 |
}
|
22 |
|
23 |
function form($instance) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
function update($new_instance, $old_instance) {
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
}
|
2 |
|
3 |
class WP125_Widget extends WP_Widget {
|
4 |
|
5 |
+
function __construct() {
|
6 |
+
parent::__construct(
|
7 |
'wp125',
|
8 |
'WP125',
|
9 |
array( 'description' => 'Displays your ads' )
|
13 |
function widget($args, $instance) {
|
14 |
extract($args);
|
15 |
echo $before_widget;
|
16 |
+
if (!empty($instance['title'])) {
|
17 |
+
echo "\n".$before_title; echo $instance['title']; echo $after_title;
|
18 |
}
|
19 |
wp125_write_ads();
|
20 |
echo $after_widget;
|
21 |
}
|
22 |
|
23 |
function form($instance) {
|
24 |
+
$title = $instance['title'];
|
25 |
+
?>
|
26 |
+
<p>
|
27 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
|
28 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
|
29 |
+
</p>
|
30 |
+
<?php
|
31 |
}
|
32 |
|
33 |
function update($new_instance, $old_instance) {
|
34 |
+
$instance = array();
|
35 |
+
$instance['title'] = (!empty($new_instance['title'])) ? strip_tags($new_instance['title']) : '';
|
36 |
+
return $instance;
|
37 |
}
|
38 |
|
39 |
}
|
wp125.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.webmaster-source.com/wp125-ad-plugin-wordpress/
|
|
5 |
Description: Easily manage 125x125 ads within your WordPress Dashboard.
|
6 |
Author: Matt Harzewski (redwall_hp)
|
7 |
Author URI: http://www.webmaster-source.com
|
8 |
-
Version: 1.5.
|
9 |
*/
|
10 |
|
11 |
|
@@ -120,6 +120,7 @@ function wp125_task_check_ad_expiry() {
|
|
120 |
//Write the Ads
|
121 |
function wp125_write_ads($exclude="0") {
|
122 |
global $wpdb;
|
|
|
123 |
if ($exclude != "0") { $exclude = implode(",", $exclude); }
|
124 |
$setting_ad_orientation = get_option("wp125_ad_orientation");
|
125 |
$setting_num_slots = get_option("wp125_num_slots");
|
5 |
Description: Easily manage 125x125 ads within your WordPress Dashboard.
|
6 |
Author: Matt Harzewski (redwall_hp)
|
7 |
Author URI: http://www.webmaster-source.com
|
8 |
+
Version: 1.5.4
|
9 |
*/
|
10 |
|
11 |
|
120 |
//Write the Ads
|
121 |
function wp125_write_ads($exclude="0") {
|
122 |
global $wpdb;
|
123 |
+
$altclass = ' odd';
|
124 |
if ($exclude != "0") { $exclude = implode(",", $exclude); }
|
125 |
$setting_ad_orientation = get_option("wp125_ad_orientation");
|
126 |
$setting_num_slots = get_option("wp125_num_slots");
|