/** * The admin menu for our AdSense system */ function adsenseMenu() { $adsense = new AdsenseAdmin(); if ($_GET['page'] == basename(__FILE__)) { if ('add' == $_REQUEST['action']) { $adsense->add($_REQUEST); } elseif ('toggle' == $_REQUEST['action']) { $adsense->toggle(); } elseif ('pubid' == $_REQUEST['action']) { $adsense->pub_id($_REQUEST); } elseif ('delete' == $_REQUEST['action']) { $adsense->burninate($_REQUEST['id']); } } ?> <?php if (isset($_REQUEST['add'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Service added.'); ?> </strong></p></div> <?php } ?> <div class="wrap"> <div id="admin-options"> <h2><?php _e('AdSense Settings'); ?> </h2> <p>Here you can add in your AdSense information and ad slot info so it can be displayed on your blog. Need more help? <a href="#explain" title="Click for more info" id="explaintext">It's only a click away</a>.</p> <div id="explain"> <h3>For those that need help, here's a rundown:</h3> <ol> <li>Create an ad slot after logging into Google AdSense.</li> <li>On this page, enter your pub-id and add enter ad details.</li> <li>Enjoy. :-)</li> </ol> </div> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&toggle=true" class="form-table"> <h2>Toggle AdSense Ads</h2> <p>One click button to disable the showing of AdSense ads.</p> <?php if (wp_get_option('enable_adsense')) { if (wp_get_option('enable_adsense') == "true") { $val = "off"; } else { $val = "on"; } } else { $val = "on"; } ?> <p class="submit"> <input type="submit" name="toggle" value="Turn <?php echo $val; ?> AdSense Ads" /> <input type="hidden" name="action" value="toggle" /> </p> </form> <p>To find an ad's ID number, first log in to Google AdSense. Next, click 'AdSense Setup' and then 'Manage Ads'. In the 'Name (#ID)' column find the ad you've created. The ad's ID will be underneath the ad's name in gray font.</p> <?php if ($adsense->check() != 'false' && $adsense->count() != '') { ?> <table class="form-table" style="margin-bottom:30px;"> <tr> <th>Ad ID</th> <th style="text-align:center;">Placement</th> <th style="text-align:center;" colspan="1">Actions</th> </tr> <?php foreach ($adsense->collect() as $adslot) { ?> <tr> <td><?php echo $adslot->ad_id; ?> </td> <td style="text-align:center;"> <?php if ($adslot->placement == 'blog_header') { echo "Blog Header (728x90)"; } elseif ($adslot->placement == 'blog_post_side') { echo "Right of Blog Post (120x240)"; } elseif ($adslot->placement == 'blog_post_bottom') { echo "Underneath Home Post (300x250)"; } elseif ($adslot->placement == 'blog_sidebar') { echo "Bottom-left of Sidebar (120x600)"; } else { echo $adslot - placement; } ?> </td> <td style="text-align:center;"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&delete=true&id=<?php echo $adslot->id; ?> "> <input type="submit" name="action" value="Delete" /> <input type="hidden" name="action" value="delete" /> </form> </td> </tr> <?php } ?> </table> <?php } else { ?> <p>You haven't added any ad slots, add them here.</p> <?php } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&pubid=true" class="form-table"> <h2>Google AdSense Publisher ID</h2> <p>Please enter your AdSense Publisher ID here.</p> <p style="font-style:italic;">The Publisher ID currently in use is:<br /> <?php if (wp_get_option('adsense_pubid') != false && wp_option_isempty('adsense_pubid') == false) { echo wp_get_option('adsense_pubid'); } else { echo "N/A"; } ?> </p> <?php if (wp_get_option('adsense_pubid')) { $pub_id = wp_get_option('adsense_pubid'); } else { $pub_id = "Pub-ID"; } ?> <p><input type="text" name="pubid" id="pubid" onfocus="if(this.value=='<?php echo $pub_id; ?> ')value=''" value="<?php echo $pub_id; ?> " /></p> <p class="submit"> <input name="save" type="submit" value="Save Pub-ID" /> <input type="hidden" name="action" value="pubid" /> </p> </form> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&add=true" class="form-table"> <h2>Add an Ad Slot</h2> <p>Please leave off the pound sign (#) when entering the Ad ID. Also remember, only one ad per placement. ;-)</p> <p><input type="text" name="ad_id" id="ad_id" onfocus="if(this.value=='Ad ID')value=''" value="Ad ID" /></p> <p><select name="placement" id="title"> <option value="blog_header">Blog header (728x90)</option> <option value="blog_post_side">Right of Blog Post (120x240)</option> <option value="blog_post_bottom">Underneath Home Post (300x250)</option> <option value="blog_sidebar">Bottom-left of Sidebar (120x600)</option> </select></p> <p class="submit"> <input name="save" type="submit" value="Add Ad Slot" /> <input type="hidden" name="action" value="add" /> </p> </form> </div> <?php include_once 'advert.php'; }
/** * The admin menu for our AdSense system */ function adsenseMenu() { $adsense = new AdsenseAdmin(); ?> <?php if (isset($_REQUEST['add'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Ad code added.'); ?> </strong></p></div> <?php } ?> <div class="wrap"> <div id="admin-options"> <h2><?php _e('AdSense Settings'); ?> </h2> <p>Here you can add in your AdSense information and ad code so it can be displayed on your blog. Need more help? <a href="#explain" title="Click for more info" id="explaintext">It's only a click away</a>.</p> <div id="explain"> <h3>For those that need help, here's a rundown:</h3> <ol> <li>Create an ad slot after logging into Google AdSense.</li> <li>On this page, enter the ad code given to you in the correct field.</li> <li>Enjoy your monetized blog.</li> </ol> </div> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&toggle=true" class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <h3>Toggle AdSense Ads</h3> <p>One click button to disable the showing of AdSense ads.</p> <?php if (get_option('wicketpixie_enable_adsense')) { if (get_option('wicketpixie_enable_adsense') == "true") { $val = "off"; } else { $val = "on"; } } else { $val = "on"; } ?> <p class="submit"> <input type="submit" name="toggle" value="Turn <?php echo $val; ?> AdSense Ads" /> <input type="hidden" name="action" value="toggle" /> </p> </form> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&adsearch=true" class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <h3>AdSense for Search</h3> <p> Here you can enable and configure AdSense for Search to replace the WordPress Search in your blog. This can be a bit confusing, so here are some tips: <ul style="list-style-type:disc;margin-left:2em;"> <li>Before you can enter anything here, you must create an AdSense for Search slot in <a href="http://adsense.google.com">Google AdSense</a>.</li> <li>You must have Permalinks enabled. (See why in next tip)</li> <li>You must also create a new page named 'Search' using the AdSense for Search template.</li> <li>The PubID is the special ID in the code generated by Google AdSense (the value of the input tag named 'cx').<br/> Example: partner-pub-012345678912345:ab123-12ab</li> </ul> </p> <table class="form-table"> <tr valign="top"> <th scope="row" style="font-size:12px;text-align:left;padding-right:10px;"> Enable AdSense for Search </th> <td style="padding-right:10px;"> <?php $c = get_option('wicketpixie_adsense_search_enabled') == 'true' ? 'checked="checked"' : ''; ?> <input type='checkbox' name='wicketpixie_adsense_search_enabled' id='wicketpixie_adsense_search_enabled' <?php echo $c; ?> /> </td> </tr> <tr valign="top"> <th scope="row" style="font-size:12px;text-align:left;padding-right:10px;"> PubID </th> <td style="padding-right:10px;"> <input type='text' name='wicketpixie_adsense_search_pubid' id='wicketpixie_adsense_search_pubid' value="<?php echo get_option('wicketpixie_adsense_search_pubid'); ?> " /> </td> </tr> <tr valign="top"> <th scope="row" style="font-size:12px;text-align:left;padding-right:10px;"> Search Results URL </th> <td style="padding-right:10px;"> <?php bloginfo('home'); ?> <input type='text' name='wicketpixie_adsense_search_url' id='wicketpixie_adsense_search_url' value="/search/" disabled="disabled" /> </td> </tr> </table> <p class="submit"> <input name="adsearch" type="submit" value="Save AdSense for Search Settings" /> <input type="hidden" name="action" value="adsearch" /> </p> </form> <?php if ($adsense->check() == true && $adsense->count() != '') { ?> <table class="form-table" style="margin-bottom:30px;"> <tr> <th>Ad Code</th> <th style="text-align:center;">Placement</th> <th style="text-align:center;" colspan="1">Actions</th> </tr> <?php foreach ($adsense->collect() as $adslot) { ?> <tr> <td><?php echo htmlentities($adslot->ad_code); ?> </td> <td style="text-align:center;"> <?php if ($adslot->placement == 'blog_header') { echo "Blog Header (728x90)"; } elseif ($adslot->placement == 'blog_post_side') { echo "Right of Blog Post (120x240)"; } elseif ($adslot->placement == 'blog_post_bottom') { echo "Underneath Home Post (300x250)"; } elseif ($adslot->placement == 'blog_sidebar') { echo "Bottom-left of Sidebar (120x600)"; } elseif ($adslot->placement == 'blog_home_post_front') { echo "Home Post, Before Content (300x250)"; } elseif ($adslot->placement == 'blog_post_front') { echo "Single Post, Before Content (300x250)"; } else { echo $adslot - placement; } ?> </td> <td style="text-align:center;"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&delete=true&id=<?php echo $adslot->id; ?> "> <?php wp_nonce_field('wicketpixie-settings'); ?> <input type="submit" name="action" value="Delete" /> <input type="hidden" name="action" value="delete" /> </form> </td> </tr> <?php } ?> </table> <?php } else { ?> <p>You haven't added any ad slots, add them here.</p> <?php } ?> <?php if ($adsense->check() == true) { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&add=true" class="form-table"> <?php wp_nonce_field('wicketpixie-settings'); ?> <h2>Add an Ad Slot</h2> <p>Remember, copy your ad code from the AdSense site after creating your ad slot. Also remember, only one ad per placement. ;-)</p> <p><textarea name="ad_code" id="ad_code" onfocus="if(this.innerHTML=='Ad Code') this.innerHTML = ''">Ad Code</textarea></p> <p><select name="placement" id="title"> <option value="blog_header">Blog header (728x90)</option> <option value="blog_post_side">Right of Blog Post (120x240)</option> <option value="blog_post_bottom">Underneath Home Post (300x250)</option> <option value="blog_sidebar">Bottom-left of Sidebar (120x600)</option> <option value="blog_home_post_front">Home Post, Before Content (300x250)</option> <option value="blog_post_front">Single Post, Before Content (300x250)</option> </select></p> <p class="submit"> <input name="save" type="submit" value="Add Ad Slot" /> <input type="hidden" name="action" value="add" /> </p> </form> <?php } else { ?> <h2>Install AdSense table</h2> <p>You need to install the AdSense table before adding ad slots.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=adsenseads.php&install=true"> <p class="submit"> <input name="save" type="submit" value="Install AdSense table"/> <input type="hidden" name="action" value="install"/> </p> </form> <?php } ?> </div> <?php include_once 'advert.php'; }