本文整理汇总了PHP中get_plugin_page_hookname函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_page_hookname函数的具体用法?PHP get_plugin_page_hookname怎么用?PHP get_plugin_page_hookname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_page_hookname函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionHookIsValid
private function actionHookIsValid($menuSlug, $parentSlug)
{
$menuSlug = plugin_basename($menuSlug);
$parentSlug = plugin_basename($parentSlug);
$hookname = get_plugin_page_hookname($menuSlug, $parentSlug);
return !has_action($hookname);
}
示例2: detach
/**
* Revert the result of attach()
*
* @return void
**/
function detach()
{
parent::detach();
$this->drop_unique_page();
$page_hook = get_plugin_page_hookname($this->settings['file'], '');
remove_action('load-' . $page_hook, array($this, '_save'));
}
示例3: bp_core_add_admin_menu_page
/**
* In BuddyPress 1.1 - 1.2.x, this function provided a better version of add_menu_page()
* that allowed positioning of menus. Deprecated in 1.5 in favour of a nxt core function.
*
* @deprecated 1.5
* @deprecated Use add_menu_page().
* @since 1.1
*/
function bp_core_add_admin_menu_page($args = '')
{
global $_registered_pages, $admin_page_hooks, $menu;
_deprecated_function(__FUNCTION__, '1.5', 'Use add_menu_page()');
$defaults = array('access_level' => 2, 'file' => false, 'function' => false, 'icon_url' => false, 'menu_title' => '', 'page_title' => '', 'position' => 100);
$r = nxt_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
$file = plugin_basename($file);
$hookname = get_plugin_page_hookname($file, '');
$admin_page_hooks[$file] = sanitize_title($menu_title);
if (!empty($function) && !empty($hookname)) {
add_action($hookname, $function);
}
if (empty($icon_url)) {
$icon_url = 'images/generic.png';
} elseif (is_ssl() && 0 === strpos($icon_url, 'http://')) {
$icon_url = 'https://' . substr($icon_url, 7);
}
do {
$position++;
} while (!empty($menu[$position]));
$menu[$position] = array($menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url);
$_registered_pages[$hookname] = true;
return $hookname;
}
示例4: add_menu_page
function add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = null)
{
global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
$menu_slug = plugin_basename($menu_slug);
$admin_page_hooks[$menu_slug] = sanitize_title($menu_title);
$hookname = get_plugin_page_hookname($menu_slug, '');
if (!empty($function) && !empty($hookname) && current_user_can($capability)) {
add_action($hookname, $function);
}
if (empty($icon_url)) {
$icon_url = 'dashicons-admin-generic';
$icon_class = 'menu-icon-generic ';
} else {
$icon_url = set_url_scheme($icon_url);
$icon_class = '';
}
$new_menu = array($menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $hookname, $hookname, $icon_url);
if (null === $position) {
$menu[] = $new_menu;
} else {
$menu = insertInArray($menu, $position, $new_menu);
}
$_registered_pages[$hookname] = true;
// No parent as top level
$_parent_pages[$menu_slug] = false;
return $hookname;
}
示例5: add_pages
/**
* Adds additional management pages
*/
public static function add_pages()
{
if (!current_user_can('manage_options')) {
return;
}
global $_registered_pages;
/** Template management page */
$hookname = get_plugin_page_hookname('wp_cta_manage_templates', 'edit.php?post_type=wp-call-to-action');
if (!empty($hookname)) {
add_action($hookname, array(__CLASS__, 'display_management_page'));
}
$_registered_pages[$hookname] = true;
/** Template upload page */
$hookname = get_plugin_page_hookname('wp_cta_templates_upload', 'edit.php?post_type=wp-call-to-action');
if (!empty($hookname)) {
add_action($hookname, array(__CLASS__, 'display_upload_page'));
}
$_registered_pages[$hookname] = true;
/** Template search page */
$hookname = get_plugin_page_hookname('wp_cta_store', 'edit.php?post_type=wp-call-to-action');
if (!empty($hookname)) {
add_action($hookname, array(__CLASS__, 'display_store_search'));
}
$_registered_pages[$hookname] = true;
}
示例6: admin_menu
/**
* Register plugin menus
*
* @return void
*/
public function admin_menu() {
// sublevel Export menu
$export_page_hook_suffix = get_plugin_page_hookname( 'site-migration-export', 'site-migration-export' );
add_action(
'admin_print_scripts-' . $export_page_hook_suffix,
array( $this, 'register_export_scripts_and_styles' )
);
// sublevel Import menu
$import_page_hook_suffix = get_plugin_page_hookname( 'site-migration-import', 'site-migration-export' );
add_action(
'admin_print_scripts-' . $import_page_hook_suffix,
array( $this, 'register_import_scripts_and_styles' )
);
// sublevel Settings menu
$settings_page_hook_suffix = add_submenu_page(
'site-migration-export',
__( 'Google Drive Settings', AI1WMGE_PLUGIN_NAME ),
__( 'Google Drive Settings', AI1WMGE_PLUGIN_NAME ),
'export',
'site-migration-gdrive-settings',
'Ai1wmge_Settings_Controller::index'
);
add_action(
'admin_print_scripts-' . $settings_page_hook_suffix,
array( $this, 'register_settings_scripts_and_styles' )
);
}
示例7: register_menu
public function register_menu()
{
add_action('admin_init', array(&$this, 'register_options'));
if (isset($this->help)) {
add_contextual_help(get_plugin_page_hookname($this->slug, ''), $this->help);
}
}
示例8: add_hidden_pages
function add_hidden_pages()
{
global $_registered_pages;
$menu_slug = 'tf_shortcodes_preview';
$hookname = get_plugin_page_hookname($menu_slug, '');
if (!empty($hookname)) {
add_action($hookname, array($this, 'preview_shortcode'));
}
$_registered_pages[$hookname] = true;
}
示例9: add_non_menu_page
public function add_non_menu_page($slug, $callback)
{
global $_registered_pages;
$hookname = get_plugin_page_hookname($slug, '');
if (!empty($hookname)) {
add_action($hookname, $callback);
}
$_registered_pages[$hookname] = true;
return $hookname;
}
示例10: addAdminMenu
/**
* action hook for building admin menu
*/
public function addAdminMenu()
{
// register the instructions page, only linked from plugin page
global $_registered_pages;
$hookname = get_plugin_page_hookname(self::MENU_PAGE . '-instructions', '');
if (!empty($hookname)) {
add_action($hookname, array($this, 'instructions'));
$_registered_pages[$hookname] = true;
}
}
示例11: marketplace_register_admin_page
function marketplace_register_admin_page()
{
global $_registered_pages;
$menu_slug = plugin_basename('setcommision.php');
$hookname = get_plugin_page_hookname($menu_slug, '');
if (!empty($hookname)) {
add_action($hookname, 'commision_setting_layout');
}
$_registered_pages[$hookname] = true;
}
示例12: add_menu_items
/**
* Add Groups Import settings page
*
* @since 1.0.0
*/
public function add_menu_items()
{
global $_registered_pages;
// Register Import Groups page
if (current_user_can('manage_woocommerce')) {
// Modifies the `$_registered_pages` global directly
$hookname = get_plugin_page_hookname('wc-memberships-import-groups', null);
add_action($hookname, array($this, 'render_import_page'));
$_registered_pages[$hookname] = true;
}
}
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:16,代码来源:class-wc-memberships-integration-groups.php
示例13: add_menu
public function add_menu()
{
global $Ktai_Style;
add_menu_page(__('Ktai Style Configuration', 'ktai_style'), __('Mobile Output', 'ktai_style'), 'manage_options', self::OPTIONS, array($this, 'misc_page'), $Ktai_Style->get('plugin_url') . KtaiStyle::CONFIG_DIR . '/icon16.png');
add_submenu_page(self::OPTIONS, __('Ktai Style Configuration', 'ktai_style'), __('Behavior', 'ktai_style'), 'manage_options', self::OPTIONS, array($this, 'misc_page'));
add_submenu_page(self::OPTIONS, __('Theme for mobile', 'ktai_style'), __('Theme', 'ktai_style'), 'switch_themes', self::THEME_OPTIONS, array($this, 'theme_page'));
add_action('load-' . get_plugin_page_hookname(self::THEME_OPTIONS, ''), array($this, 'theme_page_header'));
add_action('load-' . get_plugin_page_hookname(self::THEME_OPTIONS, ''), array($this, 'update_common_theme'));
add_submenu_page(self::OPTIONS, __('Mobile Theme Configuration', 'ktai_style'), __('Color & Format', 'ktai_style'), 'manage_options', self::COLOR_OPTIONS, array($this, 'color_page'));
add_submenu_page(self::OPTIONS, __('Delete Configuration', 'ktai_style'), __('Delete Options', 'ktai_style'), 'manage_options', self::DELETE_OPTIONS, array($this, 'delete_page'));
add_action('admin_print_styles', array($this, 'icon_style'));
}
示例14: mp_core_install_plugin_page
/**
* Create mp core install plugin page
*
* @access public
* @since 1.0.0
* @see get_plugin_page_hookname()
* @see add_action()
* @return void
*/
public function mp_core_install_plugin_page()
{
// This WordPress variable is essential: it stores which admin pages are registered to WordPress
global $_registered_pages;
// Get the name of the hook for this plugin
// We use "options-general.php" as the parent as we want our page to appear under "options-general.php?page=mp_core_install_plugin_page" . $this->plugin_name_slug
$hookname = get_plugin_page_hookname('mp_core_install_plugin_page_' . $this->plugin_name_slug, 'options-general.php');
// Add the callback via the action on $hookname, so the callback function is called when the page "options-general.php?page=mp_core_install_plugin_page" . $this->plugin_name_slug is loaded
if (!empty($hookname)) {
add_action($hookname, array($this, 'mp_core_install_check_callback'));
}
// Add this page to the registered pages
$_registered_pages[$hookname] = true;
}
示例15: surveys_add_menu_links
function surveys_add_menu_links()
{
global $wp_version, $_registered_pages;
$view_level = 2;
$page = 'edit.php';
if ($wp_version >= '2.7') {
$page = 'tools.php';
}
add_submenu_page($page, __('Manage Surveys', 'surveys'), __('Manage Surveys', 'surveys'), $view_level, 'surveys/survey.php');
$code_pages = array('export.php', 'export_choose.php', 'individual_responses.php', 'question.php', 'question_form.php', 'responses.php', 'show_individual_response.php', 'survey_action.php', 'survey_form.php');
foreach ($code_pages as $code_page) {
$hookname = get_plugin_page_hookname("surveys/{$code_page}", '');
$_registered_pages[$hookname] = true;
}
}