Docs: Improve documentation for `get_plugin_page_hook()` and `get_plugin_page_hookname()`.

Props subrataemfluence, desrosj.
Fixes #44224.
Built from https://develop.svn.wordpress.org/trunk@45085


git-svn-id: http://core.svn.wordpress.org/trunk@44894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-04-01 14:09:52 +00:00
parent 06d8f376ea
commit 0aedea9470
2 changed files with 18 additions and 8 deletions

View File

@ -1354,8 +1354,8 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
$_registered_pages[ $hookname ] = true;
/*
* Backward-compatibility for plugins using add_management page.
* See wp-admin/admin.php for redirect from edit.php to tools.php
* Backward-compatibility for plugins using add_management_page().
* See wp-admin/admin.php for redirect from edit.php to tools.php.
*/
if ( 'tools.php' == $parent_slug ) {
$_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
@ -1713,6 +1713,8 @@ function menu_page_url( $menu_slug, $echo = true ) {
* @global array $_wp_real_parent_file
* @global array $_wp_menu_nopriv
* @global array $_wp_submenu_nopriv
*
* @return string
*/
function get_admin_page_parent( $parent = '' ) {
global $parent_file, $menu, $submenu, $pagenow, $typenow,
@ -1783,6 +1785,8 @@ function get_admin_page_parent( $parent = '' ) {
* @global string $pagenow
* @global string $plugin_page
* @global string $typenow
*
* @return string
*/
function get_admin_page_title() {
global $title, $menu, $submenu, $pagenow, $plugin_page, $typenow;
@ -1859,9 +1863,10 @@ function get_admin_page_title() {
/**
* @since 2.3.0
*
* @param string $plugin_page
* @param string $parent_page
* @return string|null
* @param string $plugin_page The slug name of the plugin page.
* @param string $parent_page The slug name for the parent menu (or the file name of a standard
* WordPress admin page).
* @return string|null Hook attached to the plugin page, null otherwise.
*/
function get_plugin_page_hook( $plugin_page, $parent_page ) {
$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
@ -1874,8 +1879,11 @@ function get_plugin_page_hook( $plugin_page, $parent_page ) {
/**
* @global array $admin_page_hooks
* @param string $plugin_page
* @param string $parent_page
*
* @param string $plugin_page The slug name of the plugin page.
* @param string $parent_page The slug name for the parent menu (or the file name of a standard
* WordPress admin page).
* @return string Hook name for the plugin page.
*/
function get_plugin_page_hookname( $plugin_page, $parent_page ) {
global $admin_page_hooks;
@ -1906,6 +1914,8 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
* @global array $_wp_submenu_nopriv
* @global string $plugin_page
* @global array $_registered_pages
*
* @return bool Whether the current user can access the current admin page.
*/
function user_can_access_admin_page() {
global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv,

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta1-45084';
$wp_version = '5.2-beta1-45085';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.