function adinj_max_num_ads($adtype, $pagetype) { $ops = adinj_options(); if (adinj_ticked('exclude_' . $pagetype)) { return 0; } if ($adtype == 'top' || $adtype == 'random' || $adtype == 'bottom' || $adtype == 'footer' || $adtype == 'widget' || $adtype == 'template') { if (adinj_ticked($adtype . '_exclude_' . $pagetype)) { return 0; } } if ($adtype == 'top' || $adtype == 'random' || $adtype == 'bottom' || $adtype == 'footer') { if (adinj_count_live_ads($adtype, $ops) == 0) { return 0; } } if ($pagetype == 'front') { // front could be an archive or a page so we don't do an ad count return 1; } if ($adtype == 'top' || $adtype == 'bottom') { if ($pagetype == "single" || $pagetype == "page") { return 1; } else { if ($pagetype == 'home' || $pagetype == 'archive') { return $ops[$pagetype . '_max_num_' . $adtype . '_ads_per_page']; } else { if ($pagetype == "excerpt") { //TODO } } } } else { if ($adtype == "random") { if ($pagetype == "single" || $pagetype == "page") { return $ops['max_num_of_ads']; } else { if ($pagetype == 'home' || $pagetype == 'archive') { if ($ops[$pagetype . '_max_num_random_ads_per_post'] > 0) { return $ops[$pagetype . '_max_num_random_ads_per_page']; } } else { if ($pagetype == "excerpt") { //TODO } } } } } if ($adtype == 'widget' || $adtype == 'footer' || $adtype == 'template') { return 1; } return 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&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 }