function adinj_add_alignment_options($prefix) { adinj_add_alignment_clear_options($prefix); echo "<br />"; adinj_add_padding_top_bottom_options($prefix); echo "<br />"; adinj_add_margin_top_bottom_options($prefix); }
function form($instance) { $instance = $this->adinj_upgrade_widget_db($instance, $instance); $savedfieldname = $this->get_field_name('saved'); $savedfieldvalue = $instance['saved']; ?> <input type='hidden' <?php $this->add_name('db_version'); ?> value='<?php echo $defaults['db_version']; ?> ' /> <input type='hidden' name="$savedfieldname" value='$savedfieldvalue' /> <p> <b>Title:</b><br /> <input id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " style="width:490px;" /> <br /> <span style="font-size:10px;">Make sure any title complies with your ad provider's TOS. More info for <a href="http://adsense.blogspot.com/2007/04/encouraging-clicks.html" target="_new">AdSense</a> users.</span> </p> <style type="text/css"> .adinjtable td { vertical-align: top; } </style> <table border="0" width="490px" class="adinjtable"> <?php $total_ad_split = adinj_total_split('advert_', $instance); $this->add_row('advert_', 1, 'Ad code 1', 'ui_ad_1_show', $total_ad_split, $instance); ?> </table> <?php if ($savedfieldvalue != 1) { echo '<b>The widget needs to be saved for first time to activate the other options.</b>'; return; } ?> <br /> <b> Exclude this widget from page types</b> <?php $this->add_show_hide_section('ad_pagetypes_' . uniqid(''), 'ui_pagetypes_show', $instance); ?> <?php $count_pages = wp_count_posts('page', 'readable'); $count_posts = wp_count_posts('post', 'readable'); ?> <?php $this->add_checkbox('exclude_front', $instance); ?> front - <?php echo get_bloginfo('url'); ?> <br /> <?php $this->add_checkbox('exclude_home', $instance); ?> home page (latest posts page - may or may not be same as front)<br /> <?php $this->add_checkbox('exclude_page', $instance); ?> page - <?php echo $count_pages->publish; ?> single page(s)<br /> <?php $this->add_checkbox('exclude_single', $instance); ?> single - <?php echo $count_posts->publish; ?> single post(s)<br /> <?php $this->add_checkbox('exclude_archive', $instance); ?> archive - categories, tags, authors, dates<br /> <?php $this->add_checkbox('exclude_search', $instance); ?> search<br /> <?php $this->add_checkbox('exclude_404', $instance); ?> 404<br /> <span style="font-size:10px;"><b>Notes:</b> Your home page is the page displaying your latest posts. It may be different to your front page if you have configured your front page to be a static page.</span><br /> <span style="font-size:10px;">If you have <a href='options-reading.php'>set your front page</a> to be a static 'page' rather than your latest posts, the 'page' tick box will also apply to the front page.</span> </div> <br /> <b> Category, tag, author and id conditions</b> <?php $this->add_show_hide_section('ad_restrictions_' . uniqid(''), 'ui_conditions_show', $instance); adinj_condition_table('widget_category', 'category slugs. e.g: cat1, cat2, cat3', 'category', $instance, $this->get_field_name('widget_category_condition_mode'), $this->get_field_name('widget_category_condition_entries')); adinj_condition_table('widget_tag', 'tag slugs. e.g: tag1, tag2, tag3', 'tag', $instance, $this->get_field_name('widget_tag_condition_mode'), $this->get_field_name('widget_tag_condition_entries')); adinj_condition_table('widget_author', 'author nicknames. e.g: john, paul', 'author', $instance, $this->get_field_name('widget_author_condition_mode'), $this->get_field_name('widget_author_condition_entries')); adinj_condition_table('widget_id', 'post/page ids. e.g: 7, 23, 276', 'id', $instance, $this->get_field_name('widget_id_condition_mode'), $this->get_field_name('widget_id_condition_entries')); echo '</div>'; ?> <br /> <b> Spacing and alignment options</b> <?php $this->add_show_hide_section('ad_spacing_' . uniqid(''), 'ui_spacing_show', $instance); ?> <table border="0" width="490px" class="adinjtable"> <tr><td> <?php adinj_add_alignment_clear_options('widget_', $instance, $this->get_field_name('align'), $this->get_field_name('clear')); ?> </td><td> <?php adinj_add_margin_top_bottom_options('widget_', $instance, $this->get_field_name('margin_top'), $this->get_field_name('margin_bottom')); ?> </td><td> <?php adinj_add_padding_top_bottom_options('widget_', $instance, $this->get_field_name('padding_top'), $this->get_field_name('padding_bottom')); ?> </td></tr> </table> </div> <br /> <b> Ad rotation pool</b> <?php $this->add_show_hide_section('ad_pool_' . uniqid(''), 'ui_ad_pool_show', $instance); ?> <table border="0" width="490px" class="adinjtable"> <?php for ($i = 2; $i <= 10; ++$i) { $this->add_row('advert_', $i, 'Ad code ' . $i, 'ui_ad_' . $i . '_show', $total_ad_split, $instance); } ?> </table></div> <br /> <b> Alt content pool</b> <?php $this->add_show_hide_section('alt_pool_' . uniqid(''), 'ui_alt_pool_show', $instance); ?> <table border="0" cellspacing="5" width="490px" class="adinjtable"> <?php $total_alt_split = adinj_total_split('advert_alt_', $instance); for ($i = 1; $i <= 3; ++$i) { $this->add_row('advert_alt_', $i, 'Alt content ' . $i, 'ui_alt_' . $i . '_show', $total_alt_split, $instance); } ?> </table></div> <br /> <p>Other options to define who sees these adverts (by page age, IP, referrer) are on the main <a href='options-general.php?page=ad-injection.php'>Ad Injection settings page</a>. You can also set a global <a href='options-general.php?page=ad-injection.php#global'>page type</a> restriction for the widgets.</p> <?php }