Advertisement
Viruthagiri

network ad

Dec 19th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. Plugin Name: Ad settings!
  4. Plugin URI: http://www.script-install.com/
  5. Description: Custom ad settings
  6. Version: 0.1
  7. Author: Viruthagiri Thirumavalavan
  8. Author URI: http://www.script-install.com/
  9. */
  10. // Ad 1
  11. function ads1() {
  12.     $options = get_option('ad_options');
  13.     echo $options['ads1'];
  14. }
  15. // Ad 2
  16. function ads2() {
  17.     $options = get_option('ad_options');
  18.     echo $options['ads2'];
  19. }
  20.  
  21. // options page
  22. function ad_options() {
  23.     $options = $newoptions = get_option('ad_options');
  24.     // if submitted, process results
  25.     if ( $_POST["adstuff_submit"] ) {
  26.        $newoptions['ads1'] = stripslashes($_POST["ads1"]);
  27.        $newoptions['ads2'] = stripslashes($_POST["ads2"]);
  28.             }
  29.     // any changes? save!
  30.     if ( $options != $newoptions ) {
  31.         $options = $newoptions;
  32.         update_option('ad_options', $options);
  33.     }
  34.     // options form
  35.     echo '<form method="post">';
  36.     echo "<div class=\"wrap\"><h2>Ad options</h2>";
  37.     echo '<table class="form-table">';
  38.     // Ad 1
  39.     echo '<tr valign="top"><th scope="row">200 x 200 Ad code</th>';
  40.     echo '<td><textarea size="100" style="width: 98%; font-size: 12px;" class="code" name="ads1" id="ads1" cols="60" rows="2">'.$options['ads1'].'</textarea></td></tr>';
  41.     // Ad 1
  42.     echo '<tr valign="top"><th scope="row">300 x 250 Ad code</th>';
  43.     echo '<td><textarea size="100" style="width: 98%; font-size: 12px;" class="code" name="ads2" id="ads2" cols="60" rows="2">'.$options['ads2'].'</textarea></td></tr>';
  44.     // close stuff
  45.     echo '<input type="hidden" name="adstuff_submit" value="true"></input>';
  46.     echo '</table>';
  47.     echo '<p class="submit"><input type="submit" value="Update Options &raquo;"></input></p>';
  48.     echo "</div>";
  49.     echo '</form>';
  50. }
  51.  
  52.  
  53. function adstuff_add_pages() {
  54.     add_submenu_page('settings.php', 'Ad settings', 'Ad settings', 10, __FILE__, 'ad_options');
  55. }
  56.  
  57.  
  58. add_action('network_admin_menu', 'adstuff_add_pages');
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement