This repository was archived by the owner on Feb 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypepadConf.php
More file actions
311 lines (267 loc) · 10.4 KB
/
typepadConf.php
File metadata and controls
311 lines (267 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?php
if($_REQUEST['_wpnonce']
&& check_admin_referer('typepad-admin')){
//process the inputs and present the valid ones for prefill
$cleaned=$this->_processConfigChange($_REQUEST);
}
if(! $antispam_val=$cleaned['antispam_key']){
$antispam_val=$this->_antispamKey;
}
if(! $leaderboard_val=$cleaned['leaderboard_code']){
$leaderboard_val=$this->_leaderboardCode;
}
if(! $media_code=$cleaned['media_code']){
$media_code=$this->_mediaCode;
}
//toggle defaults
if($this->_enabledMedia){
$media_enabled_yes='checked="checked"';
}
else{
$media_enabled_no='checked="checked"';
//hide unneeded rows
$jqueryConditional.='
$(\'.mediaRow\').hide();
';
}
//toggle defaults
if($this->_enabledAntiSpam){
$antispam_enabled_yes='checked="checked"';
}
else{
$antispam_enabled_no='checked="checked"';
//hide unneeded rows
$jqueryConditional.='
$(\'.antispamRow\').hide();
';
}
if($this->_antispamTrash){
$antispam_trash_yes='checked="checked"';
}
else{
$antispam_trash_no='checked="checked"';
}
?>
<div class="wrap">
<?php if(!empty($this->_formSuccess)){
/* simple messaging--should be moved in the main class */
?>
<div class="updated"><p><strong><?php echo implode(', ',$this->_formSuccess)?> Changed Successfully</strong></p></div>
<?php } ?>
<?php if(!empty($this->_formFailure)){
?>
<div class="error"><strong><p><?php echo implode(', ',$this->_formFailure)?> Changes Failed</strong></p></div>
<?php } ?>
<div id="icon-plugins" class="icon32"><br/></div>
<h2>TypePad Services for WordPress</h2>
<form method="post" action="<?php echo TY_SUPER_MENU; ?>?page=<?php echo TY_PAGE; ?>">
<?php wp_nonce_field('typepad-admin'); ?>
<?php /* not loving the tables, but since wp uses them */
/**
* For each service we will check for the installed and enabled before showing options
* with appropriate prompts for action.
*/
?>
<table class="form-table">
<tr valign="top" class="tyMedia">
<tr valign="top" class="typeAntiSpam">
<td colspan="2"> <h3>TypePad AntiSpam</h3>
<a href="http://antispam.typepad.com/">Visit the TypePad AntiSpam homepage</a> </td>
</tr>
<tr valign="top" class="typeAntiSpam">
<th scope="row" class="antispamCell">AntiSpam Enabled</th>
<td class="antispamCell"><input type="radio" name="antispam_enabled" value="1" id="antispamEnabledYes" class="antispamEnabled" <?php echo $antispam_enabled_yes; ?> /><label for="antispamEnabledYes">Yes</label>
<input type="radio" name="antispam_enabled" value="0" id="antispamEnabledNo" class="antispamEnabled" <?php echo $antispam_enabled_no; ?> /><label for="antispamEnabledNo">No</label>
</td>
</tr>
<tr valign="top" class="antispamRow">
<th scope="row" class="antispamCell">TypePad AntiSpam Key</th>
<td class="antispamCell"><input type="text" name="antispam_key" value="<?php echo $antispam_val; ?>" size="32" />
<?php
if(!$this->_antispamKey){
echo '<a href="'.TY_KEY_URL.'">Get Key</a>';
}
?>
</td>
</tr>
<tr valign="top" class="antispamRow">
<th scope="row" class="antispamCell">Throw Out Spam After A Month?</th>
<td class="antispamCell"><input type="radio" name="antispam_trash" value="1" id="antispamTrashYes" class="antispamTrash" <?php echo $antispam_trash_yes; ?> /><label for="antispamTrashYes">Yes</label>
<input type="radio" name="antispam_trash" value="0" id="antispamTrashNo" class="antispamTrash" <?php echo $antispam_trash_no; ?> /><label for="antispamTrashNo">No</label>
</td>
</tr>
<tr valign="top" class="tyMedia">
<td><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</td>
</tr>
<tr valign="top" class="tyMedia">
<td><h3>Six Apart Media</h3>
<a href="http://sixapart.com/advertising">Visit the Six Apart Media homepage</a>
</td>
</tr>
<tr valign="top" class="tyMedia">
<th scope="row" class="mediaCell">Media Enabled</th>
<td class="mediaCell"><input type="radio" name="media_enabled" value="1" id="mediaEnabledYes" class="mediaEnabled" <?php echo $media_enabled_yes; ?> /><label for="mediaEnabledYes">Yes</label>
<input type="radio" name="media_enabled" value="0" id="mediaEnabledNo" class="mediaEnabled" <?php echo $media_enabled_no; ?> /><label for="mediaEnabledNo">No</label>
</td>
</tr>
<tr valign="top" class="mediaRow">
<th scope="row" class="mediaCell">Media Javascript</th>
<td class="mediaCell"><input type="text" name="leaderboard_code" value="<?php echo htmlentities($leaderboard_val); ?>" style="width:40em;"/><br />
Log in <a href="http://app.adify.com/MemberPages/SiteCreationFlow/GetAdSpaceTags.aspx" target="_blank">here</a> and get the value for 'Ad Tag for Leaderboard'
</td>
</tr>
<?php
if(!empty($media_code)){
?>
<tr valign="top" class="mediaRow">
<td colspan="2" class="mediaCell">
<h3 id="installLeader">To install standard leaderboard-style ads</h3>
</td></tr>
<tr valign="top" class="mediaRow subLeader">
<td colspan="2" class="mediaCell">
Add the following to <a href="/wp-admin/theme-editor.php?file=/themes/<?php echo get_current_theme(); ?>/header.php" target="_blank" ><?php echo get_template_directory(); ?>/header.php</a> right after the "<div id="page">"<br />
<textarea style="width: 95%"><script type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo $media_code; ?>&width=728&height=90&js=1"></script></textarea>
<p>
OR<br />
Enter the code <b><?php echo TY_FILTER_PREFIX.$media_code; ?>_LEADER</b> into a post or page.
</p>
<p>
OR<br />
Put this in your theme: <b><?php echo addTypePadAd('<?php echo $media_code; ?>','LEADER'); ?></b>
</p>
<h4>Example</h4>
<script language="javascript" type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo $media_code; ?>&width=728&height=90&js=1"></script>
</td>
</tr>
<tr valign="top" class="mediaRow">
<td colspan="2" class="mediaCell">
<h3 id="installSidebar">To install standard sidebar ads</h3>
</td></tr>
<tr valign="top" class="mediaRow subSidebar">
<td colspan="2" class="mediaCell">
If you have a 'widget-aware' theme.
<ul>
<li> Go to Widgets</li>
<li> Click Add text</li>
<li>Save Changes</li>
<li>Click Edit Text</li>
<li>Copy and paste the following into text box</li>
</ul>
<textarea style="width: 95%"><script type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+200); ?>&width=160&height=600&js=1></script></textarea>
<p>
OR<br />
Enter the code <b><?php echo TY_FILTER_PREFIX.($media_code+200); ?>_SIDEBAR</b> into a post or page.
</p>
<p>
OR<br />
Put this in your theme: <b><?php echo addTypePadAd('<?php echo ($media_code+200); ?>','SIDEBAR'); ?></b>
</p>
<h4>Example</h4>
<script language="javascript" type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+200); ?>&width=160&height=600&js=1"></script>
</td>
</tr>
<tr valign="top" class="mediaRow">
<td colspan="2" class="mediaCell">
<h3 id="installRectangle">To install rectangle ads</h3>
</td></tr>
<tr valign="top" class="mediaRow subRectangle">
<td colspan="2" class="mediaCell">
Place the following code in your theme.
<textarea style="width: 95%">
<script type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+100); ?>&width=300&height=250&js=1></script></textarea>
<p>
OR<br />
Enter the code <b><?php echo TY_FILTER_PREFIX.($media_code+100); ?>_RECTANGLE</b> into a post or page.
</p>
<p>
OR<br />
Put this in your theme: <b><?php echo addTypePadAd('<?php echo ($media_code+100); ?>','RECTANGLE'); ?></b>
</p>
<h4>Example</h4>
<script language="javascript" type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+100); ?>&width=300&height=250&js=1"></script>
</td>
</tr>
<tr valign="top" class="mediaRow">
<td colspan="2" class="mediaCell">
<h3 id="installBadge">To install badge ads</h3>
</td></tr>
<tr valign="top" class="mediaRow subBadge">
<td colspan="2" class="mediaCell">
Place the following code in your theme.
<textarea style="width: 95%">
<script type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+300); ?>&width=160&height=90&js=1></script></textarea>
<p>
OR<br />
Enter the code <b><?php echo TY_FILTER_PREFIX.($media_code+300); ?>_BADGE</b> into a post or page.
</p>
<p>
OR<br />
Put this in your theme: <b><?php echo addTypePadAd('<?php echo ($media_code+300); ?>','BADGE'); ?></b>
</p>
<h4>Example</h4>
<script language="javascript" type="text/javascript" src="http://ads.sixapart.com/custom?id=<?php echo ($media_code+300); ?>&width=160&height=90&js=1"></script>
</td>
</tr>
<?php
}
?>
</table>
<input type="hidden" name="action" value="update" />
<!-- <input type="hidden" name="page_options" value="new_option_name,some_other_option,option_etc" /> -->
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
<?php
/* jQuery below just handles the click-n-show of the varies part
* but wouldn't be great to handle some ajax here? wouldn't it?
*/
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(function($) {
$(document).ready(function() {
$('#installLeader').css('cursor','pointer');
$('#installSidebar').css('cursor','pointer');
$('#installRectangle').css('cursor','pointer');
$('#installBadge').css('cursor','pointer');
<?php
echo $jqueryConditional;
?>
$('.mediaEnabled').bind('change',function(){
if ($('#mediaEnabledYes:checked').val()){
$('.mediaRow').fadeIn('slow');
}
else{
$('.mediaRow').fadeOut('slow');
}
}
);
$('.antispamEnabled').bind('change',function(){
if ($('#antispamEnabledYes:checked').val()){
$('.antispamRow').fadeIn('slow');
}
else{
$('.antispamRow').fadeOut('slow');
}
}
);
$('#installLeader').bind('click',function(){
$('.subLeader').toggle();
});
$('#installSidebar').bind('click',function(){
$('.subSidebar').toggle();
});
$('#installRectangle').bind('click',function(){
$('.subRectangle').toggle();
});
$('#installBadge').bind('click',function(){
$('.subBadge').toggle();
});
}
);
}
);
</script>