title: Wordpress constants in plugin aren't available in included files
body: <p>My problem is that my constants aren't being globally available to files included deeper within my plugin. Let me explain.</p>
  
  <p>In my main wordpress plugin file, the very first line right after the necessary /* Plugin Name: blah blah etc... */ I include my constants like so</p>
  
  <pre><code>require_once( plugin_dir_path(__FILE__) . 'constants.php' );
  </code></pre>
  
  <p>Next, within my __construct() function I include another file which builds the menu items in the admin section of wordpress like so</p>
  
  <pre><code>require_once( TRADESHOW_DIR . 'structure/build_menu.php' );
  </code></pre>
  
  <p>The build_menu.php file works as a router with mor require_once calls to pages corresponding to each menu page, and submenu. Here's where I don't get it. within the build_menu.php I still have access to my constants, which I use to do wordpress database queries using them, but I don't have access to the constants within the files that are included right after. Here's the code:</p>
  
  <pre><code>//// build_menu.php
  
  function tradeshow_all_forms() {// callback from a wordpress add_submenu_page() function
    global $wpdb;
  
    $TS = new Bio_Tradeshow_Request_Plugin();//  store plugin class in variable
  
    if( isset( $_GET['form_id'] ) &amp;&amp; is_integer( intval( $_GET['form_id'] ) ) ) {
      $form = $wpdb-&gt;get_results(
          "
              SELECT *
              FROM " . TRADESHOW_FORMS . "
              WHERE id = '" . $_GET['form_id'] . "'
          "
      );
      $form = $form[0];
  
      echo TRADESHOW_SUBMITTED . ' build_menu.php&lt;br /&gt;';// echo's out the correct value
      require_once( TRADESHOW_DIR . 'structure/fill_form.php' );
    }
  }
  </code></pre>
  
  <p>Here's the top part of the fill_form.php file</p>
  
  <pre><code>$user_id = $TS-&gt;user();
  $user_id = $user_id['id'];
  
  $form_aswers = $wpdb-&gt;get_row(// returns nothing because TRADESHOW_SUBMITTED doesn't work
    "
        SELECT answers
        FROM " . TRADESHOW_SUBMITTED . "
      WHERE user_id = '$user_id' AND form_id = '$form-&gt;id'
    ",
    ARRAY_A
  );
  
  echo TRADSHOW_SUBMITTED;// echoes out TRADESHOW_SUBMITTED as a string and not a variable
  </code></pre>
  
  <p>So as you can see it's an include within an include within the main plugin.</p>
  
  <p>Additionally if anyone could explain to me why the $this variable of the plugin isn't available within files included within the plugin. I have this at the top of my plugin</p>
  
  <pre><code>static $_o = null;
  static public function init() {
      if (self::$_o === null)
          self::$_o = new self;
      return self::$_o;
  }
  </code></pre>
  
  <p>so that I can do $variable = new plugin_class; but I would like to understand if something gets lost when you include a file using require or require_once.</p>