function adinj_add_row_with_text_box($name_stem, $num, $title, $total)
{
    $ops = adinj_options();
    $name = $name_stem . $num;
    $namesplit = $name . '_split';
    $percent = adinj_percentage_split($name_stem, $num, $ops, $total);
    echo <<<EOT
\t<tr><td>
\t<a name="{$name}"></a>
\t<span style="font-size:10px;"><b>{$title} {$num}</b></span><br />
\t<textarea name="{$name}" rows="8" cols="
EOT;
    adinj_table_width('rotation');
    echo '">' . adinj_process_text($ops[$name]);
    echo <<<EOT
</textarea>
\t</td><td>
\t<input name="{$namesplit}" size="7" value="{$ops[$namesplit]}" />
\t<br />
\t{$percent}
\t</td></tr>
EOT;
}
Example #2
0
function adinj_adverts_box($ops)
{
    adinj_postbox_start(__("Adverts", 'adinj'), 'adverts');
    ?>
	
	<h3><a name="topadcode"></a>Top ad (below post title - this is not a 'header' ad) [<a href="#topadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_top'>pool</a>]--></h3>
	<table border="0" class="adinjtable" width="98%">
	<tr><td>
	<textarea name="ad_code_top_1" rows="10" cols="<?php 
    adinj_table_width('ad');
    ?>
"><?php 
    echo adinj_process_text($ops['ad_code_top_1']);
    ?>
</textarea>
	<br />
	<p><span style="font-size:10px;"><b>Docs:</b> Try a <a href="#468x15">468x15</a> or <a href="#336x280">336x280</a> advert.</span></p>
	</td><td>
	<?php 
    adinj_add_alignment_options('top_');
    echo "<br /><b><a href='?page=ad-injection&amp;tab=adrotation#multiple_top'>Rotation:<br />" . adinj_percentage_split('ad_code_top_', 1, $ops) . "</a></b>";
    ?>
	</td></tr>
	</table>
	<p><span style="font-size:10px;">Be especially careful if you decide to use the 'float' layout options. Make sure that you don't have adverts floated over the top of other page elements, or vice-versa.</span></p>
	
	<h3><a name="randomadcode"></a>Random ad (inserted randomly between paragraphs) [<a href="#randomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_random'>pool</a>]--></h3>
	<table border="0" class="adinjtable" width="98%">
	<tr><td>
	<textarea name="ad_code_random_1" rows="10" cols="<?php 
    adinj_table_width('ad');
    ?>
"><?php 
    echo adinj_process_text($ops['ad_code_random_1']);
    ?>
</textarea>
	<br />
	<p><span style="font-size:10px;"><b>Docs:</b> Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</span></p>
	</td><td>
	<?php 
    adinj_add_alignment_options('rnd_');
    echo "<br /><b><a href='?page=ad-injection&amp;tab=adrotation#multiple_random'>Rotation:<br />" . adinj_percentage_split('ad_code_random_', 1, $ops) . "</a></b>";
    ?>
	</td></tr>
	</table>
	
	<h3><a name="bottomadcode"></a>Bottom ad (below the post content) [<a href="#bottomadplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_bottom'>pool</a>]--></h3>
	<table border="0" class="adinjtable" width="98%">
	<tr><td>
	<textarea name="ad_code_bottom_1" rows="10" cols="<?php 
    adinj_table_width('ad');
    ?>
"><?php 
    echo adinj_process_text($ops['ad_code_bottom_1']);
    ?>
</textarea>
	<br />
	<p><span style="font-size:10px;"><b>Docs:</b> Try a <a href="#336x280">336x280</a> advert.</span></p>
	</td><td>
	<?php 
    adinj_add_alignment_options('bottom_');
    echo "<br /><b><a href='?page=ad-injection&amp;tab=adrotation#multiple_bottom'>Rotation:<br />" . adinj_percentage_split('ad_code_bottom_', 1, $ops) . "</a></b>";
    ?>
	</td></tr>
	</table>
	
	
	<h3><a name="footeradcode"></a>Footer ad (put into 'the_footer' hook - not supported by all themes) [<a href="#footeradplacement">placement</a>] <!--[<a href='?page=ad-injection&amp;tab=adrotation#multiple_footer'>pool</a>]--></h3>
	<table border="0" class="adinjtable" width="98%">
	<tr><td>
	<textarea name="ad_code_footer_1" rows="10" cols="<?php 
    adinj_table_width('ad');
    ?>
"><?php 
    echo adinj_process_text($ops['ad_code_footer_1']);
    ?>
</textarea>
	<br />
	Docs: footer ad information and troubleshooting
	<?php 
    adinj_add_show_hide_section('footer_docs_' . uniqid(''), 'ui_footer_docs_show', 'ui_footer_docs_show', $ops);
    ?>
	<blockquote>
	<p><span style="font-size:10px;">Try a <a href="#468x60">468x60</a> or <a href="#728x90">728x90</a> banner.</span></p>
	<p><span style="font-size:10px;">The footer ad will only work if your theme supports it.</span></p>
	<p><span style="font-size:10px;">Your theme must include 'the_footer' hook in the correct part of the page. If the footer ad is appearing in the wrong place, you could try manually editing your theme to move 'the_footer' hook.</span></p>
	</blockquote>
	</div>
	</td><td>
	<?php 
    adinj_add_alignment_options('footer_');
    echo "<br /><b><a href='?page=ad-injection&amp;tab=adrotation#multiple_footer'>Rotation:<br />" . adinj_percentage_split('ad_code_footer_', 1, $ops) . "</a></b>";
    ?>
	</td></tr>
	</table>
	
	<?php 
    adinj_postbox_end();
}
    function add_row($op_stem, $num, $label, $show_op, $total_split, $ops)
    {
        $op = $op_stem . $num;
        $op_split = $op . '_split';
        $anchorid = $op . '_' . uniqid('');
        $percentage_split = adinj_percentage_split($op_stem, $num, $ops, $total_split);
        ?>
		<tr><td colspan='2'>
		<input style="float:right; padding:0; margin:0;" <?php 
        $this->add_name($op_split);
        ?>
 size="7" value="<?php 
        echo $ops[$op_split];
        ?>
" />
		
		<?php 
        echo <<<HTML
\t\t<b> {$label}</b> <label style='float:right'>(Rotation: {$percentage_split})</label>
\t\t
HTML;
        $this->add_show_hide_section($anchorid, $show_op, $ops);
        if ($op_stem == 'advert_' && $num == 2) {
            echo '<span style="font-size:10px;">These boxes are for defining rotated adverts which replace the original advert according to the percentages defined. If you want multiple sidebar/widget ads you need to drag another widget into the sidebar.</span><br />';
        }
        if ($op_stem == 'advert_alt_' && $num == 1) {
            echo '<span style="font-size:10px;">Here you can define content which is shown if ads are blocked for the viewer (only for mfunc and dynamic ad insertion modes).</span><br />';
        }
        ?>
		
		<textarea class="widefat" rows="8" cols="50" width="100%" <?php 
        $this->add_name($op);
        ?>
><?php 
        echo $ops[$op];
        ?>
</textarea>
		</div><!--add_show_hide_section-->
		</td></tr>
		<?php 
    }