I am working on a plugin and have a problem with my options page that I can't seem to figure out. The options page works just fine, it is setup in my main plugin file like this:
add_options_page('Jargonaut', 'Jargonaut', 'manage_options', 'jargonaut-settings', array($this,'jargonaut_ShowAdmin'));
And then the jargonaut_ShowAdmin() function includes a file called 'jargonaut_admin.php'. No big deal, works great.
I have been developing some stuff on that options page ('jargonaut_admin.php') but the code has been getting fairly large so I decided to break some of the form processing functionality off into a separate file and include() it. My include looks like:
global $wpdb; include_once('jargonaut_form_process.php');
When I made this change, my options page quit functioning the way I want it to (when submitting forms it just reloaded the page and did nothing else) so I added some echo() functions into 'jargonaut_form_process.php' to see where it was going wrong. Come to find out, it doesn't recognize the WordPress function get_option(). In fact, no WordPress functions work.
Now, they work beautifully if I copy that file's contents back into 'jargonaut_admin.php' and use them there.
TLDR: Why do PHP files included into admin option pages not have access to WordPress functions? What is the proper way to do this or do I have to just keep all the code in the same file?
[UPDATE] Turning on error_reporting(E_ALL|E_STRICT) and setting display_errors to true, I get this:
Fatal error: Call to undefined function get_option() in /home/cillosis/mysites/wordpress/wp-content/plugins/jargonaut/jargonaut_form_process.php on line 15
That line is my first attempt in the jargonaut_form_process.php file to access a WordPress function. I've tried adding global $wp; and global $wpdb; to the top of my included file but that doesn't help either.