add checkboxes

This commit is contained in:
John Bintz 2009-03-25 07:38:03 -04:00
parent 99668be607
commit e5f34f7a8d
2 changed files with 33 additions and 1 deletions

View File

@ -101,6 +101,12 @@ class PluginWonderful {
}
}
}
function inject_ads_into_body_copy($body) {
if ($this->publisher_info !== false) {
return $this->publisher_info->inject_ads_into_body_copy($body, (get_option("plugin-wonderful-use-standardcode") == 1));
}
}
function set_up_menu() {
add_options_page('Plugin Wonderful', __("Plugin Wonderful", 'plugin-wonderful'), 5, __FILE__, array($this, "plugin_wonderful_main"));
@ -309,7 +315,9 @@ class PluginWonderful {
$this->publisher_info = false;
}
update_option('plugin-wonderful-use-standardcode', isset($_POST['use-standardcode']) ? "1" : "0");
foreach (array('use-standardcode', 'enable-body-copy-embedding') as $field) {
update_option("plugin-wonderful-${field}", isset($_POST[$field]) ? "1" : "0");
}
}
}
@ -318,6 +326,7 @@ $plugin_wonderful = new PluginWonderful();
add_action('admin_menu', array($plugin_wonderful, 'set_up_menu'));
add_action('init', array($plugin_wonderful, 'set_up_widgets'));
add_filter('the_excerpt_rss', array($plugin_wonderful, 'insert_rss_feed_ads'));
add_filter('the_content', array($plugin_wonderful, 'inject_ads_into_body_copy'));
register_activation_hook(__FILE__, array($plugin_wonderful, 'handle_activation'));

View File

@ -21,6 +21,17 @@
</td>
</tr>
<tr>
<th scope="row"><?php _e('Enable Body Copy Embedding?', 'plugin-wonderful') ?></th>
<td>
<label>
<input type="checkbox"
name="enable-body-copy-embedding"
value="yes"
<?php echo (get_option("plugin-wonderful-enable-body-copy-embedding") == 1) ? "checked" : "" ?> />
<em><?php _e('(When enabled, you can embed ads directly in body copy using a PW() tag. Read below for more details.)', 'plugin-wonderful') ?></em>
</label>
</td>
</tr> <tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="<?php _e('Change and Redownload Adbox Information', 'plugin-wonderful') ?>" class="button" /> <em>(<?php _e('if you\'ve modified adbox settings on Project Wonderful, just click this button to refresh your adbox code.', 'plugin-wonderful') ?>)</em>
@ -100,6 +111,18 @@
&lt;?php the_project_wonderful_ad(<?php echo $first_adboxid ?>) ?&gt;
</tt>
<h3><?php _e('Embedding Ads Directly In Body Copy', 'plugin-wonderful') ?></h3>
<p>
<?php _e('In your blog post, use a PW() tag with either the adbox ID or the template tag name to embed the adbox directly in your entry:', 'plugin-wonderful') ?>
</p>
<tt>PW(<?php echo $first_adboxid ?>)</tt>
<p><?php _e('If you need to display the PW() code in your post, escape the parenthesis:', 'plugin-wonderful') ?></p>
<tt>PW\(<?php echo $first_adboxid ?>\)</tt>
<h3><?php _e('Inserting Ads Into Your RSS Feeds <em>(experimental)</em>', 'plugin-wonderful') ?></h3>
<p>
<?php _e('You can insert your Project Wonderful ads into you RSS feeds. The ads you insert into your feed also need to be crawlable by the Project Wonderful ad checking robot, so it\'s recommended that you put ads into your RSS feed that you\'re already showing on your site. Not all RSS feed readers support displaying the embedded ads.', 'plugin-wonderful') ?>