Example #1
0
function adinj_side_status_box()
{
    $ops = adinj_options();
    ?>
	<div class="postbox-container" style="width:258px;">
		<div class="metabox-holder">	
		<div class="meta-box-sortables" style="min-height:50px;">
		<div class="postbox">
		<h3 class="hndle"><span><?php 
    echo adinj_get_logo();
    ?>
 Status</span></h3>
		<div class="inside" style="margin:5px;">
			
			<style type="text/css">
			.adinjstatustable td { vertical-align: top; }
			.adinjstatustable td { padding: 2px; }
			</style>
		
			<table border="0" cellpadding="2" class="adinjstatustable">

			
			<tr><td style="text-align:right">
			<b><a href="#global">Ads enabled</a></b>
			</td><td>
			<?php 
    $info = adinj_get_status('global');
    echo adinj_dot($info[0]) . ' ' . $info[1];
    if ($info[0] != 'red') {
        ?>
			</td></tr>

			<tr><td style="text-align:right">
			<b><a href='#global'>Ads on posts</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('older_than_normal');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>

			<tr><td style="text-align:right">
			<b><a href='#global'>Widgets on posts</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('older_than_widgets');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href="#restrictions">Mode</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('mode');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href="#restrictions">Restrictions</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('restrictions');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td style="text-align:right">
			<b><a href='?page=ad-injection&amp;tab=debug#debugging'>Debug mode</a></b>
			</td><td>
			<?php 
        $info = adinj_get_status('debugging');
        echo adinj_dot($info[0]) . ' ' . $info[1];
        ?>
			</td></tr>
			
			<tr><td colspan="2">
			<p></p>
			<b>Ads on/off summary</b><br />
			<table class="adinjstatustable">
			<tr>
				<td></td>
				<td><b>Ads</b></td>
				<td><b>Alt</b></td>
				<td><b>S</b></td>
				<td><b>P</b></td>
				<td><b>H</b></td>
				<td><b>F</b></td>
				<td><b>A</b></td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#topadplacement">Top</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('top', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('top_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('top', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#randomadplacement">Random</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('random', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('random_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('random', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#bottomadplacement">Bottom</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('bottom', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('bottom_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('bottom', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b><a href="#footeradplacement">Footer</a></b></td>
				<td><?php 
        echo adinj_count_live_ads('footer', $ops);
        ?>
</td>
				<td><?php 
        echo adinj_count_live_ads('footer_alt', $ops);
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('footer', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b>Widget</b></td>
				<td></td>
				<td></td>
				<td><?php 
        adinj_print_ad_dot('widget', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('widget', 'archive');
        ?>
</td>
			</tr>
			<tr>
				<td style="text-align:right"><b>Template</b></td>
				<td></td>
				<td></td>
				<td><?php 
        adinj_print_ad_dot('template', 'single');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'page');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'home');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'front');
        ?>
</td>
				<td><?php 
        adinj_print_ad_dot('template', 'archive');
        ?>
</td>
			</tr>
			</table>
			<p>S=single post | P=single page | H=home | F=front | A=archive
			<!--E=excerpt--></p>
			</td></tr>

			<tr><td>
			</td><td>
			</td></tr>
			<tr><td>
			</td><td>
			<?php 
    }
    ?>
			</td></tr>
			</table>
		</div>
		</div>	
		</div>
		</div>
	</div> 	
	
	<br />
	<?php 
}
function adinj_postbox_start($title, $anchor, $width = '650px')
{
    $ops = adinj_options();
    ?>
	<div class='postbox-container' style='width:<?php 
    echo $width;
    ?>
;float:left; clear:left;'>
	<a name="<?php 
    echo $anchor;
    ?>
"></a>
	<div class="metabox-holder">
	<div class="postbox">
	<input type="submit" style="float:right" class="button-primary" name="adinj_action" value="<?php 
    _e('Save all settings', 'adinj');
    ?>
" />
	
	<?php 
    $anchorclick = $anchor . '_click';
    $anchorupdate = $anchor . '_update';
    $anchorhide = 'ui_' . $anchor . '_hide';
    $hide = $ops[$anchorhide];
    echo <<<HTML
\t<input type='hidden' id='{$anchorhide}' name='{$anchorhide}' value='{$hide}' />
\t<a href="#" onclick='javascript:{$anchorclick}();return false;' style="float:right;display:none" id="toggle-{$anchor}" class="button">Show/Hide</a>
\t<script type="text/javascript">
\t{$anchorupdate}();
\tjQuery('#toggle-{$anchor}').show();
\t
\tfunction {$anchorclick}(){
\t\tjQuery('#{$anchorhide}').val(!jQuery('#{$anchor}-box').is(":hidden"));
\t\tjQuery('#{$anchor}-box').slideToggle(300);
\t\t{$anchorupdate}();
\t\treturn false;
\t}
\t
\tfunction {$anchorupdate}(){
\t\tif (jQuery('#{$anchorhide}').val() == 'false'){
\t\t\tjQuery('#toggle-{$anchor}').text('Hide');
\t\t} else {
\t\t\tjQuery('#toggle-{$anchor}').text('Show');
\t\t}
\t}
\t</script>
HTML;
    ?>
	
	<h3><?php 
    $info = adinj_get_status($anchor);
    echo adinj_dot($info[0]);
    ?>
 <?php 
    echo adinj_get_logo() . ' ' . $title;
    ?>
</h3>
	<?php 
    if ($hide == 'true') {
        ?>
		<div id="<?php 
        echo $anchor;
        ?>
-box" class="hiddenbox">
	<?php 
    } else {
        ?>
		<div id="<?php 
        echo $anchor;
        ?>
-box">
	<?php 
    }
    ?>
	<div class="inside" style="margin:10px">
	<?php 
}
function adinj_docs()
{
    ?>
<hr />

<?php 
    adinj_postbox_start(__("Quick Start", 'adinj'), "docs", '95%');
    ?>

<p>1. Copy and paste your ad code into the ad code boxes.</p>

<p>2. Choose how many ads of each type you want displayed.</p>

<p>3. Configure any ad positioning (optional).</p>

<p>4. Check the ad insertion mode (in the Insertion mode and ad display restriction section).</p>

<p>5. If you are using a compatible ad insertion mode you may configure dynamic ad display restrictions. i.e. showing ads only to certain people (e.g. search engine visitors), or blocking ads from specific IPs.</p>

<p>6. Enable your ads (tick box at the very top).</p>
</div>

<h3><?php 
    echo adinj_get_logo();
    ?>
 Supported in-page tags</h3>
<div class="inside" style="margin:10px">

<p>These tags can be inserted into the page source to override the configured behaviour on individual pages. Because sometimes specific pages need to be treated differently.</p>

<ul>
<li><code>&lt;!--noadsense--&gt;</code> OR <code>&lt;!-no-adsense--&gt;</code> OR <code>&lt;!--NoAds--&gt;</code> OR <code>&lt;!--OffAds--&gt;</code> - disables all ads on this page. These tags are here to make this plugin compatible with the tags from Adsense Injection, Whydowork Adsense and Quick Adsense.</li>
</ul>

<p></p>

<ul>
<li><code>&lt;!--adsandwich--&gt;</code> - Inserts the top and bottom ad but no random ads. Disables all other ads.</li>
<li><code>&lt;!--adfooter--&gt;</code> - Insert a single ad at the very bottom. Disables all other ads.</li>
</ul>

<p></p>

<ol>
<li><code>&lt;!--adsensestart--&gt;</code> - Random ads will start from this point*. For compatibility with Adsense Injection.</li>
<li><code>&lt;!--adsenseend--&gt;</code> - Random ads will not be inserted after this point*. New tag but I've kept the Adsense Injection naming convention to make it fit with the above tag.</li>
<li><code>&lt;!--adstart--&gt;</code> - Random ads will start from this point*.</li>
<li><code>&lt;!--adend--&gt;</code> - Random ads will not be inserted after this point*.</li>
</ol>

<p>These four tags will not affect the top and bottom ad.</p>

<h4>Custom field for disabling adverts</h4>

<p>To disable all adverts on the page you can also set the custom <code>disable_adverts</code> field to '1' from the WordPress post editor.</p>


<?php 
    adinj_postbox_end();
    ?>


<?php 
    adinj_postbox_start(__("Test Adverts", 'adinj'), "testads", '95%');
    ?>

<p>You can copy and paste these adverts into the boxes above to test your ad setup before switching to your real ads.</p>

<h4><a name="468x60"></a>468x60 banner</h4>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ff9999; width:468px; height:60px;&quot;&gt;
&lt;h5&gt;TEST ADVERT 468x60 - &lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;www.reviewmylife.co.uk&lt;/a&gt;&lt;/h5&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#99ffff; width:468px; height:60px;">
<h5>TEST ADVERT 468x60 - <a href="http://www.reviewmylife.co.uk/">www.reviewmylife.co.uk</a></h5>
</div><p></p>

<h4><a name="728x90"></a>728x90 banner</h4>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ff9999; width:728px; height:90px;&quot;&gt;
&lt;h5&gt;TEST ADVERT 728x90&lt;/h5&gt;
&lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;www.reviewmylife.co.uk&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.advancedhtml.co.uk/&quot;&gt;www.advancedhtml.co.uk&lt;/a&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#ff9999; width:728px; height:90px;">
<h5>TEST ADVERT 728x90</h5>
<a href="http://www.reviewmylife.co.uk/">www.reviewmylife.co.uk</a><br />
<a href="http://www.advancedhtml.co.uk/">www.advancedhtml.co.uk</a>
</div><p></p>

<h4>160x90 link unit</h4>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ccff99; width:160px; height:90px;&quot;&gt;
&lt;h5&gt;TEST ADVERT 160x90&lt;/h5&gt;
&lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;reviewmylife.co.uk&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.advancedhtml.co.uk/&quot;&gt;advancedhtml.co.uk&lt;/a&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#ccff99; width:160px; height:90px;">
<h5>TEST ADVERT 160x90</h5>
<a href="http://www.reviewmylife.co.uk/">reviewmylife.co.uk</a>
<a href="http://www.advancedhtml.co.uk/">advancedhtml.co.uk</a><br />
</div><p></p>

<h4><a name="468x15"></a>468x15 link unit</h4>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#cccc99; width:468px; height:15px;&quot;&gt;
&lt;font size=&quot;-2&quot;&gt;&lt;b&gt;TEST ADVERT 160x90&lt;/b&gt; &lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;reviewmylife.co.uk&lt;/a&gt;&lt;/font&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#cccc99; width:468px; height:15px;">
<font size="-2"><b>TEST ADVERT 160x90</b> <a href="http://www.reviewmylife.co.uk/">reviewmylife.co.uk</a></font>
</div><p></p>

<h4><a name="336x280"></a>336x280 large rectangle</h4>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="4">&lt;div style=&quot;background-color:#ccccff; width:336px; height:280px;&quot;&gt;
&lt;h5&gt;TEST ADVERT 336x280 - &lt;a href=&quot;http://www.reviewmylife.co.uk/&quot;&gt;www.reviewmylife.co.uk&lt;/a&gt;&lt;/h5&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#ccccff; width:336px; height:280px;">
<h5>TEST ADVERT 336x280 - <a href="http://www.reviewmylife.co.uk/">www.reviewmylife.co.uk</a></h5>
</div><p></p>

<h4>468x60 banner with dynamic PHP</h4>

<p>The PHP will execute if 1) WP Super Cache is turned on in legacy mode, and 2) if WP Super Cache is not installed/disabled.</p>

<p><textarea onclick="javascript:this.focus();this.select();" style="min-height:50px;" cols="80" rows="5">&lt;div style=&quot;background-color:#ffff99; width:468px; height:60px;&quot;&gt;
&lt;b&gt;TEST ADVERT 468x60 with date() and rand()&lt;/b&gt;&lt;br /&gt;
&lt;?php echo &quot;date=&quot;.date(&quot;Y-m-d H:i:s&quot;) .&quot; rand=&quot;.rand(); ?&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.advancedhtml.co.uk/&quot;&gt;www.advancedhtml.co.uk&lt;/a&gt;
&lt;/div&gt;</textarea></p>

<div style="background-color:#ffff99; width:468px; height:60px;">
<b>TEST ADVERT 468x60 with date() and rand()</b><br />
<?php 
    echo "date=" . date("Y-m-d H:i:s") . " rand=" . rand();
    ?>
<br />
<a href="http://www.advancedhtml.co.uk/">www.advancedhtml.co.uk</a>
</div><p></p>

<?php 
    adinj_postbox_end();
}