I'm working on my own little back end framework for future clients and I'm making a folder named "Forms" to store all of my forms for CMS interaction. Inside the forms folder I'd like to store .php files similar to wordpress style plugins that I can title in the comments code like wp does... ie
/*
Plugin Name: Name Of The Plugin
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
*/
I'm wondering how WP reads that data as it is commented out... do they use file_get_contents('plugin.php'); and parse it as well as include the plugin? Is there a php function to actually read comments?
Thoughts?
explode each line by : and get result in array array[0] makes the key and array[1] makes the value.Wordpress has created its own function to handle file headers. I used this in my new Total Widget Control Plugin. Here's the function name and help docs on how to use it.
get_file_data( $file_path, $headers, $context)
string $file: Path to the file
array $default_headers: List of headers, in the format array('HeaderKey' => 'Header Name')
string $context: If specified adds filter hook "extra_{$context}_headers"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With