Advertisement
Guest User

Wordpress 3.2.1 noheader bug demo

a guest
Sep 16th, 2011
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.06 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Demonstration of noheader bug
  4. Plugin URI:
  5. Description: Demonstration of noheader bug
  6. */
  7.  
  8. add_action('admin_menu', 'test_admin_menus');
  9.  
  10. function test_admin_menus() {
  11.     $pluginPage = add_options_page('noheader test', 'noheader test', 'manage_options', 'noheader-test', 'test_display');
  12.     add_action('admin_head-'.$pluginPage,'test_admin_head');
  13.    
  14. }
  15.  
  16. function test_admin_head() {
  17.     //create a global var, so we know if run
  18.     global $test_variable_to_test;
  19.     $test_variable_to_test = 'PHP included!';
  20. }
  21.  
  22. function test_display() {
  23.     if ($_GET['noheader']) {require_once(ABSPATH.'wp-admin/admin-header.php');} //include the header if not included by WP
  24.    
  25.     global $test_variable_to_test;
  26.    
  27.     echo '<p>$test_variable_to_test was set to: <strong>'.$test_variable_to_test.'</strong></p>';
  28.  
  29.     echo '<form method="POST" action="'.get_bloginfo('url').'/wp-admin/options-general.php?page='.$_GET['page'].'&noheader=1">';
  30.     echo '<p>Submit this form to see the $test_variable_to_test variable disapper</p>';
  31.     echo '<input type="submit" />';
  32.     echo '</form>';
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement