45 lines
979 B
PHP
45 lines
979 B
PHP
|
<?php
|
||
|
/**
|
||
|
* Creates the submenu item for the plugin.
|
||
|
*
|
||
|
* Registers a new menu item under 'Admin' group and uses the dependency passed into
|
||
|
* the constructor in order to display the page corresponding to this menu item.
|
||
|
**/
|
||
|
class Submenu {
|
||
|
|
||
|
/**
|
||
|
* A reference the class responsible for rendering the submenu page.
|
||
|
**/
|
||
|
private $submenu_page;
|
||
|
|
||
|
/**
|
||
|
* Initializes all of the partial classes.
|
||
|
**/
|
||
|
public function __construct( $submenu_page ) {
|
||
|
$this->submenu_page = $submenu_page;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Adds a submenu for this plugin to the 'Tools' menu.
|
||
|
**/
|
||
|
public function init() {
|
||
|
add_action( 'admin_menu', array( $this, 'add_options_page' ) );
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates the submenu item and calls on the Submenu Page object to render
|
||
|
* the actual contents of the page.
|
||
|
**/
|
||
|
public function add_options_page() {
|
||
|
|
||
|
add_management_page(
|
||
|
'ZGo Payment Gateway Support',
|
||
|
'ZGo Payments',
|
||
|
'manage_options',
|
||
|
'zgopmtlist',
|
||
|
array( $this->submenu_page, 'render' )
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|