本文整理汇总了PHP中wpcf_admin_add_submenu_page函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_add_submenu_page函数的具体用法?PHP wpcf_admin_add_submenu_page怎么用?PHP wpcf_admin_add_submenu_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf_admin_add_submenu_page函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Call this only if you are actually showing the page.
*/
public function initialize()
{
$page_hook = wpcf_admin_add_submenu_page(array('menu_title' => $this->get_title(), 'function' => array($this, 'page_handler'), 'capability_filter' => 'wpcf_tfc_view'), wpcf_getget('page'));
// I hate having to do this. Refactor!
require_once WPCF_INC_ABSPATH . '/fields.php';
wpcf_fields_contol_common_resources();
add_action("load-{$page_hook}", array($this, 'add_screen_options'));
}
示例2: setup_installer
function setup_installer()
{
if (isset($_GET['page']) && 'installer' == $_GET['page']) {
wpcf_admin_add_submenu_page(array('menu_title' => __('Installer', 'wpcf'), 'menu_slug' => 'installer', 'function' => 'installer_content'));
}
}
示例3: add_getting_started_to_admin_menu
/**
* add Getting Started to menu
*/
public function add_getting_started_to_admin_menu()
{
$menu = array('page_title' => __('What kind of site are you building?', 'wpcf'), 'menu_title' => __('Getting Started', 'wpcf'), 'menu_slug' => basename(dirname(dirname(__FILE__))) . '/marketing/getting-started/index.php', 'hook' => 'wpcf_marketing', 'load_hook' => 'wpcf_marketing_hook');
wpcf_admin_add_submenu_page($menu);
}
示例4: wpcf_admin_add_submenu_page
function wpcf_admin_add_submenu_page($menu, $menu_slug = null, $menu_parent = 'wpcf')
{
if (!is_admin()) {
return;
}
$menu_slug = array_key_exists('menu_slug', $menu) ? $menu['menu_slug'] : $menu_slug;
$capability = array_key_exists('capability', $menu) ? $menu['capability'] : 'manage_options';
$wpcf_capability = apply_filters('wpcf_capability', $capability, $menu, $menu_slug);
$wpcf_capability = apply_filters('wpcf_capability' . $menu_slug, $capability, $menu, $menu_slug);
/**
* allow change capability by filter
* full list https://goo.gl/OJYTvl
*/
if (isset($menu['capability_filter'])) {
$wpcf_capability = apply_filters($menu['capability_filter'], $wpcf_capability, $menu, $menu_slug);
}
/**
* add submenu
*/
$hook = add_submenu_page($menu_parent, isset($menu['page_title']) ? $menu['page_title'] : $menu['menu_title'], $menu['menu_title'], $wpcf_capability, $menu_slug, array_key_exists('function', $menu) ? $menu['function'] : null);
// For given menu slug, publish the final hook name in case we need it somewhere.
do_action("wpcf_admin_add_submenu_page_{$menu_slug}", $hook);
if (!empty($menu_slug)) {
wpcf_admin_plugin_help($hook, $menu_slug);
}
/**
* add action
*/
if (!array_key_exists('load_hook', $menu) && array_key_exists('function', $menu) && is_string($menu['function'])) {
$menu['load_hook'] = sprintf('%s_hook', $menu['function']);
}
if (!empty($menu['load_hook']) && function_exists($menu['load_hook'])) {
$action = sprintf('load-%s', array_key_exists('hook', $menu) ? $menu['hook'] : $hook);
add_action($action, $menu['load_hook']);
}
/**
* add submenu to submenu
*/
if (array_key_exists('submenu', $menu)) {
foreach ($menu['submenu'] as $submenu_slug => $submenu) {
wpcf_admin_add_submenu_page($submenu, $submenu_slug, $hook);
}
}
return $hook;
}
示例5: wpcf_access_teaser_admin_menu
/**
* Teaser menu hook.
*/
function wpcf_access_teaser_admin_menu()
{
$hook = wpcf_admin_add_submenu_page(array('page_title' => __('Access Control and User Roles', 'wpcf'), 'menu_title' => __('Access Control and User Roles', 'wpcf'), 'menu_slug' => 'wpcf-access', 'function' => 'wpcf_access_teaser_admin_menu_page', 'load_hook' => 'wpcf_access_teaser_admin_menu_load'));
}
示例6: setup_installer
function setup_installer()
{
wpcf_admin_add_submenu_page(array('page_title' => __('Installer', 'wpcf'), 'menu_title' => __('Installer', 'wpcf'), 'menu_slug' => 'installer', 'function' => 'installer_content'));
}
示例7: wpcf_admin_add_submenu_page
function wpcf_admin_add_submenu_page($menu, $menu_slug = null, $menu_parent = 'wpcf')
{
if (!is_admin()) {
return;
}
$wpcf_capability = apply_filters('wpcf_capability', 'manage_options');
$menu_slug = array_key_exists('menu_slug', $menu) ? $menu['menu_slug'] : $menu_slug;
/**
* add submenu
*/
$hook = add_submenu_page($menu_parent, isset($menu['page_title']) ? $menu['page_title'] : $menu['menu_title'], $menu['menu_title'], $wpcf_capability, $menu_slug, array_key_exists('function', $menu) ? $menu['function'] : null);
if (!empty($menu_slug)) {
wpcf_admin_plugin_help($hook, $menu_slug);
}
/**
* add action
*/
if (!array_key_exists('load_hook', $menu) && array_key_exists('function', $menu)) {
$menu['load_hook'] = sprintf('%s_hook', $menu['function']);
}
if (!empty($menu['load_hook']) && function_exists($menu['load_hook'])) {
$action = sprintf('load-%s', array_key_exists('hook', $menu) ? $menu['hook'] : $hook);
add_action($action, $menu['load_hook']);
}
/**
* add submenu to submenu
*/
if (array_key_exists('submenu', $menu)) {
foreach ($menu['submenu'] as $submenu_slug => $submenu) {
wpcf_admin_add_submenu_page($submenu, $submenu_slug, $hook);
}
}
return $hook;
}
示例8: add_getting_started_to_admin_menu
/**
* add Getting Started to menu
*/
public function add_getting_started_to_admin_menu()
{
if (!isset($_REQUEST['page'])) {
return;
}
$slug = basename(dirname(dirname(dirname(__FILE__)))) . '/marketing/getting-started/index.php';
if ($_REQUEST['page'] != $slug) {
return;
}
$menu = array('page_title' => __('What kind of site are you building?', 'wpcf'), 'menu_title' => __('Getting Started', 'wpcf'), 'menu_slug' => $slug, 'hook' => 'wpcf_marketing', 'load_hook' => 'wpcf_marketing_hook');
wpcf_admin_add_submenu_page($menu);
}
示例9: wpcf_access_teaser_admin_menu
/**
* Teaser menu hook.
*/
function wpcf_access_teaser_admin_menu()
{
if (isset($_GET['page']) && 'wpcf-access' == $_GET['page']) {
$hook = wpcf_admin_add_submenu_page(array('menu_title' => __('Access', 'wpcf'), 'menu_slug' => 'wpcf-access', 'function' => 'wpcf_access_teaser_admin_menu_page', 'load_hook' => 'wpcf_access_teaser_admin_menu_load'));
}
}