Forum Moderators: coopster
/*
Plugin Name: PLug name
Plugin URI: http://www.domain.com
Description: This is css
Version: 1.0
Author: My Name
Author URI: http://www.domain.com/my-name
*/ function get_plugins_header()
{
$from_folder = 'plugin';
$extension = '.php';
if ( $handle = @opendir ( $from_folder ) )
{
while ( $file = readdir ( $handle ) )
{
if (is_file ( $from_folder . $file ) )
{
if (strpos ( $from_folder . $file, $extension ) )
{
$fp = fopen ( $from_folder . $file, 'r' );
// Pull only the first 8kiB of the file in.
$plugin_data = fread ( $fp, 8192 );
fclose ( $fp );
preg_match ( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
preg_match ( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
preg_match ( '|Version:(.*)|i', $plugin_data, $version );
preg_match ( '|Description:(.*)$|mi', $plugin_data, $description );
preg_match ( '|Author:(.*)$|mi', $plugin_data, $author_name );
preg_match ( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
foreach ( array ('name', 'uri', 'version', 'description', 'author_name', 'author_uri' ) as $field )
{
if (! empty ( ${$field} )) ${$field} = trim ( ${$field} [1] ); else ${$field} = '';
}
$plugin_data = array ('filename' => $file, 'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description, 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version );
$plugin_headers [] = $plugin_data;
}
}
elseif ( ( is_dir( $from_folder . $file ) ) && ( $file != '.' ) && ( $file != '..' ) )
{
get_plugins_header ( $from_folder . $file . '/' );
}
}
closedir ( $handle );
}
return $plugin_headers;
}
$get = get_plugins_header();
foreach ( $get as $plugin_header ) {
echo '<strong>URI</strong>: ' . $plugin_header ['PluginURI'] . '<br />';
echo '<strong>Title</strong>: ' . $plugin_header ['Title'] . '<br />';
echo '<strong>Name</strong>: ' . $plugin_header ['Name'] . '<br />';
echo '<strong>Version</strong>: ' . $plugin_header ['Version'] . '<br />';
echo '<strong>Description</strong>: ' . $plugin_header ['Description'] . '<br />';
echo '<strong>Author URL</strong>: ' . $plugin_header ['AuthorURI'] . '<br />';
echo '<strong>Author</strong>: ' . $plugin_header ['Author'];
} /*
Plugin Name: Twentyone
Plugin URI: http://domain.com
Description: This is style
Version: 1.0
Author: Kiljoy97
Author URI: http://www.domain.com/
*/