Class Name:
MP_CORE_Plugin_Directory
Purpose:
To allow the creation of directory pages in WordPress containing plugins to install.
Overview:
This class takes arguments, uses them to check an outside API (set up using the MP_Repo plugin), and displays a page of plugins which can be installed.
If the plugin requires a license, as passed-in via the $args passed through the MP_Repo plugin, this class will output a field where the license can be entered prior to installation.
Licensing is dealt with in conjunction with the MP_Repo plugin.
Usage:
new MP_CORE_Plugin_Directory( $args );
Parameters:
This class expects 1 parameter which is an associative array which tells the class where to look for the API and where to show it in the WordPress dashboard.
$args = array ( 'parent_slug' => 'plugins.php/', 'page_title' => 'Move Plugins', 'slug' => 'mp_core_plugin_directory', 'directory_list_url' => 'http://repo.moveplugins.com/repo-group/move-plugins/' );
The array keys and values above are as follows:
parent_slug (string) – The slug name for the parent menu. More info here.
page_title (string) – The title of the page in the WordPress dashboard.
slug (string) – A unique slug for this directory. It can be anything as long as it is unique.
directory_list_url (string) – The url to the MP_Repo category where the plugins are.
Full Example:
function my_plugin_directory(){ $args = array ( 'parent_slug' => 'plugins.php/', 'page_title' => 'My Directory', 'slug' => 'my_plugin_directory', 'directory_list_url' => 'http://myapiurl.com/repo-group/my-repo-group/' ); new MP_CORE_Plugin_Directory( $args ); } add_action( '_admin_menu', 'my_plugin_directory' );