• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_plugin_page_hook函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_plugin_page_hook函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_page_hook函数的具体用法?PHP get_plugin_page_hook怎么用?PHP get_plugin_page_hook使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_plugin_page_hook函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: akismet_admin_init

function akismet_admin_init() {
	if ( function_exists( 'get_plugin_page_hook' ) )
		$hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
	else
		$hook = 'dashboard_page_akismet-stats-display';
	add_action('admin_head-'.$hook, 'akismet_stats_script');
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:akismet.php


示例2: akismet_admin_init

function akismet_admin_init() {
    global $wp_version;
    
    // all admin functions are disabled in old versions
    if ( !function_exists('is_multisite') && version_compare( $wp_version, '3.0', '<' ) ) {
        
        function akismet_version_warning() {
            echo "
            <div id='akismet-warning' class='updated fade'><p><strong>".sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) ."</strong> ".sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "</p></div>
            ";
        }
        add_action('admin_notices', 'akismet_version_warning'); 
        
        return; 
    }

    if ( function_exists( 'get_plugin_page_hook' ) )
        $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
    else
        $hook = 'dashboard_page_akismet-stats-display';
    add_action('admin_head-'.$hook, 'akismet_stats_script');
    add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal');
	wp_register_style('akismet.css', AKISMET_PLUGIN_URL . '/akismet.css');
	wp_enqueue_style('akismet.css');
	wp_register_script('akismet.js', AKISMET_PLUGIN_URL . '/akismet.js', array('jquery'));
	wp_enqueue_script('akismet.js');
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:27,代码来源:admin.php


示例3: akismet_admin_init

function akismet_admin_init()
{
    global $wp_version;
    // all admin functions are disabled in old versions
    if (!function_exists('is_multisite') && version_compare($wp_version, '3.0', '<')) {
        function akismet_version_warning()
        {
            echo '
            <div id="akismet-warning" class="updated fade"><p><strong>' . sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) . '</strong> ' . sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/') . '</p></div>
            ';
        }
        add_action('admin_notices', 'akismet_version_warning');
        return;
    }
    if (function_exists('get_plugin_page_hook')) {
        $hook = get_plugin_page_hook('akismet-stats-display', 'index.php');
    } else {
        $hook = 'dashboard_page_akismet-stats-display';
    }
    add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal');
}
开发者ID:lpender,项目名称:oort,代码行数:21,代码来源:admin.php


示例4: is_hook_or_plugin_page

 private static function is_hook_or_plugin_page($page_url, $parent_page_url = '')
 {
     if (empty($parent_page_url)) {
         $parent_page_url = 'admin.php';
     }
     $pageFile = self::remove_query_from($page_url);
     //Files in /wp-admin are part of WP core so they're not plugin pages.
     if (self::is_wp_admin_file($pageFile)) {
         return false;
     }
     $hasHook = get_plugin_page_hook($page_url, $parent_page_url) !== null;
     if ($hasHook) {
         return true;
     }
     /*
      * Special case: Absolute paths.
      *
      * - add_submenu_page() applies plugin_basename() to the menu slug, so we don't need to worry about plugin
      * paths. However, absolute paths that *don't* point point to the plugins directory can be a problem.
      *
      * - Due to a known PHP bug, certain invalid paths can crash PHP. See self::is_safe_to_append().
      *
      * - WP 3.9.2 and 4.0+ unintentionally break menu URLs like "foo.php?page=c:\a\b.php" because esc_url()
      * interprets the part before the colon as an invalid protocol. As a result, such links have an empty URL
      * on Windows (but they might still work on other OS).
      *
      * - Recent versions of WP won't let you load a PHP file from outside the plugins and mu-plugins directories
      * with "admin.php?page=filename". See the validate_file() call in /wp-admin/admin.php. However, such filenames
      * can still be used as unique slugs for menus with hook callbacks, so we shouldn't reject them outright.
      * Related: https://core.trac.wordpress.org/ticket/10011
      */
     $allowPathConcatenation = self::is_safe_to_append($pageFile);
     $pluginFileExists = $allowPathConcatenation && $page_url != 'index.php' && is_file(WP_PLUGIN_DIR . '/' . $pageFile);
     if ($pluginFileExists) {
         return true;
     }
     return false;
 }
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:38,代码来源:menu-item.php


示例5: array

// Pretend you didn't see this.
$current_theme_actions = array();
if (is_array($submenu) && isset($submenu['themes.php'])) {
    foreach ((array) $submenu['themes.php'] as $item) {
        $class = '';
        if ('themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos($item[2], 'customize.php')) {
            continue;
        }
        // 0 = name, 1 = capability, 2 = file
        if (strcmp($self, $item[2]) == 0 && empty($parent_file) || $parent_file && $item[2] == $parent_file) {
            $class = ' current';
        }
        if (!empty($submenu[$item[2]])) {
            $submenu[$item[2]] = array_values($submenu[$item[2]]);
            // Re-index.
            $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
            if (file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) {
                $current_theme_actions[] = "<a class='button button-secondary{$class}' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
            } else {
                $current_theme_actions[] = "<a class='button button-secondary{$class}' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
            }
        } elseif (!empty($item[2]) && current_user_can($item[1])) {
            $menu_file = $item[2];
            if (current_user_can('customize')) {
                if ('custom-header' === $menu_file) {
                    $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize{$class}' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
                } elseif ('custom-background' === $menu_file) {
                    $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize{$class}' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
                }
            }
            if (false !== ($pos = strpos($menu_file, '?'))) {
开发者ID:ycms,项目名称:framework,代码行数:31,代码来源:themes.php


示例6: _wp_menu_output

/**
 * Display menu.
 *
 * @access private
 * @since 2.7.0
 *
 * @global string $self
 * @global string $parent_file
 * @global string $submenu_file
 * @global string $plugin_page
 * @global string $typenow
 *
 * @param array $menu
 * @param array $submenu
 * @param bool  $submenu_as_parent
 */
function _wp_menu_output($menu, $submenu, $submenu_as_parent = true)
{
    global $self, $parent_file, $submenu_file, $plugin_page, $typenow;
    $first = true;
    // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url
    foreach ($menu as $key => $item) {
        $admin_is_parent = false;
        $class = array();
        $aria_attributes = '';
        $aria_hidden = '';
        $is_separator = false;
        if ($first) {
            $class[] = 'wp-first-item';
            $first = false;
        }
        $submenu_items = array();
        if (!empty($submenu[$item[2]])) {
            $class[] = 'wp-has-submenu';
            $submenu_items = $submenu[$item[2]];
        }
        if ($parent_file && $item[2] == $parent_file || empty($typenow) && $self == $item[2]) {
            $class[] = !empty($submenu_items) ? 'wp-has-current-submenu wp-menu-open' : 'current';
        } else {
            $class[] = 'wp-not-current-submenu';
            if (!empty($submenu_items)) {
                $aria_attributes .= 'aria-haspopup="true"';
            }
        }
        if (!empty($item[4])) {
            $class[] = esc_attr($item[4]);
        }
        $class = $class ? ' class="' . join(' ', $class) . '"' : '';
        $id = !empty($item[5]) ? ' id="' . preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]) . '"' : '';
        $img = $img_style = '';
        $img_class = ' dashicons-before';
        if (false !== strpos($class, 'wp-menu-separator')) {
            $is_separator = true;
        }
        /*
         * If the string 'none' (previously 'div') is passed instead of an URL, don't output
         * the default menu image so an icon can be added to div.wp-menu-image as background
         * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
         * as special cases.
         */
        if (!empty($item[6])) {
            $img = '<img src="' . $item[6] . '" alt="" />';
            if ('none' === $item[6] || 'div' === $item[6]) {
                $img = '<br />';
            } elseif (0 === strpos($item[6], 'data:image/svg+xml;base64,')) {
                $img = '<br />';
                $img_style = ' style="background-image:url(\'' . esc_attr($item[6]) . '\')"';
                $img_class = ' svg';
            } elseif (0 === strpos($item[6], 'dashicons-')) {
                $img = '<br />';
                $img_class = ' dashicons-before ' . sanitize_html_class($item[6]);
            }
        }
        $arrow = '<div class="wp-menu-arrow"><div></div></div>';
        $title = wptexturize($item[0]);
        // hide separators from screen readers
        if ($is_separator) {
            $aria_hidden = ' aria-hidden="true"';
        }
        echo "\n\t<li{$class}{$id}{$aria_hidden}>";
        if ($is_separator) {
            echo '<div class="separator"></div>';
        } elseif ($submenu_as_parent && !empty($submenu_items)) {
            $submenu_items = array_values($submenu_items);
            // Re-index.
            $menu_hook = get_plugin_page_hook($submenu_items[0][2], $item[2]);
            $menu_file = $submenu_items[0][2];
            if (false !== ($pos = strpos($menu_file, '?'))) {
                $menu_file = substr($menu_file, 0, $pos);
            }
            if (!empty($menu_hook) || 'index.php' != $submenu_items[0][2] && file_exists(WP_PLUGIN_DIR . "/{$menu_file}") && !file_exists(ABSPATH . "/wp-admin/{$menu_file}")) {
                $admin_is_parent = true;
                echo "<a href='admin.php?page={$submenu_items[0][2]}'{$class} {$aria_attributes}>{$arrow}<div class='wp-menu-image{$img_class}'{$img_style}>{$img}</div><div class='wp-menu-name'>{$title}</div></a>";
            } else {
                echo "\n\t<a href='{$submenu_items[0][2]}'{$class} {$aria_attributes}>{$arrow}<div class='wp-menu-image{$img_class}'{$img_style}>{$img}</div><div class='wp-menu-name'>{$title}</div></a>";
            }
        } elseif (!empty($item[2]) && current_user_can($item[1])) {
            $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
            $menu_file = $item[2];
            if (false !== ($pos = strpos($menu_file, '?'))) {
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:menu-header.php


示例7: require

            }
        } else {
            $$wpvar = $_POST["$wpvar"];
        }
    }
}

$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;

require(ABSPATH . '/wp-admin/menu.php');

// Handle plugin admin pages.
if (isset($_GET['page'])) {
	$plugin_page = stripslashes($_GET['page']);
	$plugin_page = plugin_basename($plugin_page);
	$page_hook = get_plugin_page_hook($plugin_page, $pagenow);

	if ( $page_hook ) {
		if (! isset($_GET['noheader']))
			require_once(ABSPATH . '/wp-admin/admin-header.php');
		
		do_action($page_hook);
	} else {
		if ( validate_file($plugin_page) ) {
			die(__('Invalid plugin page'));
		}
		
		if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
			die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));

		if (! isset($_GET['noheader']))
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:admin.php


示例8: _wp_menu_output

/**
 * Display menu.
 *
 * @access private
 * @since 2.7.0
 *
 * @param array $menu
 * @param array $submenu
 * @param bool $submenu_as_parent
 */
function _wp_menu_output($menu, $submenu, $submenu_as_parent = true)
{
    global $self, $parent_file, $submenu_file, $plugin_page, $pagenow;
    $first = true;
    // 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
    foreach ($menu as $key => $item) {
        $admin_is_parent = false;
        $class = array();
        if ($first) {
            $class[] = 'wp-first-item';
            $first = false;
        }
        if (!empty($submenu[$item[2]])) {
            $class[] = 'wp-has-submenu';
        }
        if ($parent_file && $item[2] == $parent_file || strcmp($self, $item[2]) == 0) {
            if (!empty($submenu[$item[2]])) {
                $class[] = 'wp-has-current-submenu wp-menu-open';
            } else {
                $class[] = 'current';
            }
        }
        if (isset($item[4]) && !empty($item[4])) {
            $class[] = $item[4];
        }
        $class = $class ? ' class="' . join(' ', $class) . '"' : '';
        $tabindex = ' tabindex="1"';
        $id = isset($item[5]) && !empty($item[5]) ? ' id="' . preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]) . '"' : '';
        $img = '';
        if (isset($item[6]) && !empty($item[6])) {
            if ('div' === $item[6]) {
                $img = '<br />';
            } else {
                $img = '<img src="' . $item[6] . '" alt="" />';
            }
        }
        $toggle = '<div class="wp-menu-toggle"><br /></div>';
        echo "\n\t<li{$class}{$id}>";
        if (false !== strpos($class, 'wp-menu-separator')) {
            echo '<a class="separator" href="?unfoldmenu=1"><br /></a>';
        } elseif ($submenu_as_parent && !empty($submenu[$item[2]])) {
            $submenu[$item[2]] = array_values($submenu[$item[2]]);
            // Re-index.
            $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
            $menu_file = $submenu[$item[2]][0][2];
            if (false !== ($pos = strpos($menu_file, '?'))) {
                $menu_file = substr($menu_file, 0, $pos);
            }
            if ('index.php' != $submenu[$item[2]][0][2] && file_exists(WP_PLUGIN_DIR . "/{$menu_file}") || !empty($menu_hook)) {
                $admin_is_parent = true;
                echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>{$img}</a></div>{$toggle}<a href='admin.php?page={$submenu[$item[2]][0][2]}'{$class}{$tabindex}>{$item[0]}</a>";
            } else {
                echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>{$img}</a></div>{$toggle}<a href='{$submenu[$item[2]][0][2]}'{$class}{$tabindex}>{$item[0]}</a>";
            }
        } else {
            if (current_user_can($item[1])) {
                $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
                $menu_file = $item[2];
                if (false !== ($pos = strpos($menu_file, '?'))) {
                    $menu_file = substr($menu_file, 0, $pos);
                }
                if ('index.php' != $item[2] && file_exists(WP_PLUGIN_DIR . "/{$menu_file}") || !empty($menu_hook)) {
                    $admin_is_parent = true;
                    echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>{$img}</a></div>{$toggle}<a href='admin.php?page={$item[2]}'{$class}{$tabindex}>{$item[0]}</a>";
                } else {
                    echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}'>{$img}</a></div>{$toggle}<a href='{$item[2]}'{$class}{$tabindex}>{$item[0]}</a>";
                }
            }
        }
        if (!empty($submenu[$item[2]])) {
            echo "\n\t<div class='wp-submenu'><div class='wp-submenu-head'>{$item[0]}</div><ul>";
            $first = true;
            foreach ($submenu[$item[2]] as $sub_key => $sub_item) {
                if (!current_user_can($sub_item[1])) {
                    continue;
                }
                $class = array();
                if ($first) {
                    $class[] = 'wp-first-item';
                    $first = false;
                }
                $menu_file = $item[2];
                if (false !== ($pos = strpos($menu_file, '?'))) {
                    $menu_file = substr($menu_file, 0, $pos);
                }
                if (isset($submenu_file)) {
                    if ($submenu_file == $sub_item[2]) {
                        $class[] = 'current';
                    }
                    // If plugin_page is set the parent must either match the current page or not physically exist.
//.........这里部分代码省略.........
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:101,代码来源:menu-header.php


示例9: get_admin_page_title

function get_admin_page_title() {
	global $title;
	global $menu;
	global $submenu;
	global $pagenow;
	global $plugin_page;

	if ( isset( $title ) && !empty ( $title ) ) {
		return $title;
	}

	$hook = get_plugin_page_hook( $plugin_page, $pagenow );

	$parent = $parent1 = get_admin_page_parent();
	if ( empty ( $parent) ) {
		foreach ( $menu as $menu_array ) {
			if ( isset( $menu_array[3] ) ) {
				if ( $menu_array[2] == $pagenow ) {
					$title = $menu_array[3];
					return $menu_array[3];
				} else
					if ( isset( $plugin_page ) && ($plugin_page == $menu_array[2] ) && ($hook == $menu_array[3] ) ) {
						$title = $menu_array[3];
						return $menu_array[3];
					}
			} else {
				$title = $menu_array[0];
				return $title;
			}
		}
	} else {
		foreach (array_keys( $submenu ) as $parent) {
			foreach ( $submenu[$parent] as $submenu_array ) {
				if ( isset( $plugin_page ) && 
					($plugin_page == $submenu_array[2] ) && 
					(($parent == $pagenow ) || ($parent == $plugin_page ) || ($plugin_page == $hook ) || (($pagenow == 'admin.php' ) && ($parent1 != $submenu_array[2] ) ) )
					) {
						$title = $submenu_array[3];
						return $submenu_array[3];
					}

				if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) // not the current page
					continue;

				if ( isset( $submenu_array[3] ) ) {
					$title = $submenu_array[3];
					return $submenu_array[3];
				} else {
					$title = $submenu_array[0];
					return $title;
				}
			}
		}
	}

	return $title;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:57,代码来源:admin-functions.php


示例10: submenu2assoc

 /**
  * Convert a WP submenu structure to an associative array
  *
  * @param array $item An element of the $submenu array
  * @param integer $pos The position (index) of that element
  * @param string $parent Parent file that this menu item belongs to.
  * @return array
  */
 function submenu2assoc($item, $pos = 0, $parent = '')
 {
     $item = array('menu_title' => $item[0], 'access_level' => $item[1], 'file' => $item[2], 'page_title' => isset($item[3]) ? $item[3] : '', 'position' => $pos);
     //Save the default parent menu
     $item['parent'] = $parent;
     //Flag plugin pages
     $item['is_plugin_page'] = get_plugin_page_hook($item['file'], $parent) != null;
     return array_merge($this->templates['basic_defaults'], $item);
 }
开发者ID:alek0805,项目名称:8020consulting,代码行数:17,代码来源:menu-editor-core.php


示例11: query_menu_subitem

 /**
  * Query if the menu subitem exists
  * 
  * We probably want to use get_plugin_page_hook()
  *
  * @param string $menu_slug e.g. "oik_menu"
  * @param string $sub_item e.g. "oik_themes"
  * @return string|null the hookname it's registered
  */
 function query_menu_subitem($menu_slug, $parent)
 {
     $hookname = get_plugin_page_hook($menu_slug, $parent);
     return $hookname;
 }
开发者ID:bobbingwide,项目名称:genesis-image,代码行数:14,代码来源:class-oik-theme-update.php


示例12: wpjobads_add_admin_pages

function wpjobads_add_admin_pages()
{
    global $wpdb;
    global $plugin_page, $pagenow;
    $table_job = $wpdb->prefix . WPJOBADS_JOB;
    $unapproved = intval($wpdb->get_var("SELECT COUNT(id) AS unapproved FROM {$table_job} WHERE ad_approved = 0"));
    $submenu = array();
    add_menu_page(__('WPJobAds for WordPress', 'wpjobads'), __('WPJobAds', 'wpjobads'), 10, __FILE__, 'wpjobads_admin_index');
    $submenu['wpjobads_admin_load_jobs'] = add_submenu_page(__FILE__, __('WPJobAds Listings', 'wpjobads'), __('Jobs', 'wpjobads'), 10, 'wpjobads-admin-jobs', 'wpjobads_admin_jobs');
    if ($unapproved or $_GET['page'] == 'wpjobads-admin-approvals' and isset($_GET['message'])) {
        $submenu['wpjobads_admin_load_approvals'] = add_submenu_page(__FILE__, __('WPJobAds Approvals', 'wpjobads'), sprintf(__('Awaiting Approval (%d)', 'wpjobads'), $unapproved), 10, 'wpjobads-admin-approvals', 'wpjobads_admin_approvals');
    }
    $submenu['wpjobads_admin_load_categories'] = add_submenu_page(__FILE__, __('WPJobAds Categories', 'wpjobads'), __('Categories', 'wpjobads'), 10, 'wpjobads-admin-categories', 'wpjobads_admin_categories');
    $submenu['wpjobads_admin_load_options'] = add_submenu_page(__FILE__, __('WPJobAds Options', 'wpjobads'), __('Options', 'wpjobads'), 10, 'wpjobads-admin-options', 'wpjobads_admin_options');
    $submenu['wpjobads_admin_load_uninstall'] = add_submenu_page(__FILE__, __('WPJobAds Uninstall', 'wpjobads'), __('Uninstall', 'wpjobads'), 10, 'wpjobads-admin-uninstall', 'wpjobads_admin_uninstall');
    foreach ($submenu as $handler => $page_hook) {
        if ($page_hook == get_plugin_page_hook($plugin_page, $pagenow)) {
            add_action('load-' . $page_hook, $handler);
        }
    }
}
开发者ID:simpsonjulian,项目名称:puppet-wordpress,代码行数:21,代码来源:wpjobads.php


示例13: load_page

 public function load_page($load_title = false)
 {
     global $plugin_page, $hook_suffix, $current_screen, $title, $menu, $submenu, $pagenow, $typenow;
     $pagenow = 'admin.php';
     $typenow = '';
     $this->init_load();
     $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
     if ($page && wp_verify_nonce($_REQUEST['nonce'], 'mainwp_ajax')) {
         $plugin_page = stripslashes($page);
         $plugin_page = plugin_basename($plugin_page);
         if ($plugin_page) {
             $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
             $hook_suffix = $page_hook;
             if ($load_title) {
                 echo esc_html($this->get_title());
                 exit;
             }
             set_current_screen();
             do_action('load-' . $page_hook);
             screen_meta($current_screen);
             // Back compatibility with 3.2
             //$current_screen->render_screen_meta(); // For 3.3
             do_action($page_hook);
         }
     }
     exit;
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:27,代码来源:class-mainwp-ajax.php


示例14: duoshuo_admin_initialize

function duoshuo_admin_initialize()
{
    global $wp_version, $duoshuoPlugin, $plugin_page;
    //在admin界面内执行的action
    // wordpress2.8 以后都支持这个过滤器
    add_filter('plugin_action_links_duoshuo/duoshuo.php', array($duoshuoPlugin, 'pluginActionLinks'), 10, 2);
    if (empty($duoshuoPlugin->shortName) || empty($duoshuoPlugin->secret)) {
        //你尚未安装这个插件。
        function duoshuo_config_warning()
        {
            echo '<div class="updated"><p><strong>只要再<a href="' . admin_url('admin.php?page=duoshuo') . '">配置一下</a>多说帐号,多说就能开始为您服务了。</strong></p></div>';
        }
        if ($plugin_page !== 'duoshuo') {
            add_action('admin_notices', 'duoshuo_config_warning');
        }
        return;
    }
    add_action('admin_notices', array($duoshuoPlugin, 'notices'));
    add_action('switch_theme', array($duoshuoPlugin, 'updateSite'));
    //	support from WP 2.9
    //add_action('updated_option', array($duoshuoPlugin, 'updatedOption'));
    add_filter('post_row_actions', array($duoshuoPlugin, 'actionsFilter'));
    if (function_exists('get_post_types')) {
        //	support from WP 2.9
        $post_types = get_post_types(array('public' => true, 'show_in_nav_menus' => true), 'objects');
        foreach ($post_types as $type => $object) {
            add_meta_box('duoshuo-sidebox', '同时发布到', array($duoshuoPlugin, 'syncOptions'), $type, 'side', 'high');
        }
    } else {
        add_meta_box('duoshuo-sidebox', '同时发布到', array($duoshuoPlugin, 'syncOptions'), 'post', 'side', 'high');
        add_meta_box('duoshuo-sidebox', '同时发布到', array($duoshuoPlugin, 'syncOptions'), 'page', 'side', 'high');
    }
    //wp 3.0以下不支持此项功能
    /**
    * TODO 
    	if ($post !== null && 'publish' == $post->post_status || 'private' == $post->post_status)
    		add_meta_box('duoshuo-comments', '来自社交网站的评论(多说)', array($duoshuoPlugin,'managePostComments'), 'post', 'normal', 'low');
    */
    add_action('profile_update', array($duoshuoPlugin, 'syncUserToRemote'));
    add_action('user_register', array($duoshuoPlugin, 'syncUserToRemote'));
    add_action('wp_dashboard_setup', 'duoshuo_add_dashboard_widget');
    //// backwards compatible (before WP 3.0)
    if (version_compare($wp_version, '3.0', '<') && current_user_can('administrator')) {
        function duoshuo_wp_version_notice()
        {
            echo '<div class="updated"><p>您的WordPress版本低于3.0,如果您能升级WordPress,多说就能更好地为您服务。</p></div>';
        }
        add_action(get_plugin_page_hook('duoshuo', 'duoshuo'), 'duoshuo_wp_version_notice');
        add_action(get_plugin_page_hook('duoshuo-preferences', 'duoshuo'), 'duoshuo_wp_version_notice');
        add_action(get_plugin_page_hook('duoshuo-settings', 'duoshuo'), 'duoshuo_wp_version_notice');
    }
    if (!is_numeric($duoshuoPlugin->getOption('synchronized')) && current_user_can('administrator')) {
        function duoshuo_unsynchronized_notice()
        {
            echo '<div class="updated"><p>上一次同步没有完成,<a href="' . admin_url('admin.php?page=duoshuo-settings') . '">点此继续同步</a></p></div>';
        }
        add_action(get_plugin_page_hook('duoshuo', 'duoshuo'), 'duoshuo_unsynchronized_notice');
        add_action(get_plugin_page_hook('duoshuo-preferences', 'duoshuo'), 'duoshuo_unsynchronized_notice');
        add_action(get_plugin_page_hook('duoshuo-settings', 'duoshuo'), 'duoshuo_unsynchronized_notice');
    }
    add_action('admin_head-edit-comments.php', array($duoshuoPlugin, 'originalCommentsNotice'));
    if (defined('DOING_AJAX')) {
        add_action('wp_ajax_duoshuo_export', array($duoshuoPlugin, 'export'));
        add_action('wp_ajax_duoshuo_sync_log', array($duoshuoPlugin, 'syncLogAction'));
    }
    duoshuo_common_initialize();
}
开发者ID:songsanren,项目名称:My-blog,代码行数:67,代码来源:duoshuo.php


示例15: is_hook_or_plugin_page

 private static function is_hook_or_plugin_page($page_url, $parent_page_url = '')
 {
     if (empty($parent_page_url)) {
         $parent_page_url = 'admin.php';
     }
     $pageFile = self::remove_query_from($page_url);
     /*
      * Special case: Absolute paths.
      *
      * - add_submenu_page() applies plugin_basename() to the menu slug, so we don't need to worry about plugin
      * paths. However, absolute paths that *don't* point point to the plugins directory can be a problem.
      *
      * - If we blindly append $pageFile to another path, we'll get something like "C:\a\b/wp-admin/C:\c\d.php".
      * PHP 5.2.5 has a known bug where calling file_exists() on that kind of an invalid filename will cause
      * a timeout and a crash in some configurations. See: https://bugs.php.net/bug.php?id=44412
      *
      * - WP 3.9.2 and 4.0+ unintentionally break menu URLs like "foo.php?page=c:\a\b.php" because esc_url()
      * interprets the part before the colon as an invalid protocol. As a result, such links have an empty URL
      * on Windows (but they might still work on other OS).
      *
      * - Recent versions of WP won't let you load a PHP file from outside the plugins and mu-plugins directories
      * with "admin.php?page=filename". See the validate_file() call in /wp-admin/admin.php. However, such filenames
      * can still be used as unique slugs for menus with hook callbacks, so we shouldn't reject them outright.
      * Related: https://core.trac.wordpress.org/ticket/10011
      */
     $allowPathConcatenation = substr($pageFile, 1, 1) !== ':';
     //Reject "C:\whatever" and similar.
     //Check our hard-coded list of admin pages first. It's measurably faster than
     //hitting the disk with is_file().
     if (isset(self::$known_wp_admin_files[$pageFile])) {
         return false;
     }
     //Now actually check the filesystem.
     $adminFileExists = $allowPathConcatenation && is_file(ABSPATH . 'wp-admin/' . $pageFile);
     if ($adminFileExists) {
         return false;
     }
     $hasHook = get_plugin_page_hook($page_url, $parent_page_url) !== null;
     if ($hasHook) {
         return true;
     }
     //Note: We don't need to call plugin_basename() on $pageFile because add_submenu_page() already did that.
     $pluginFileExists = $allowPathConcatenation && $page_url != 'index.php' && is_file(WP_PLUGIN_DIR . '/' . $pageFile);
     if ($pluginFileExists) {
         return true;
     }
     return false;
 }
开发者ID:elangovanaspire,项目名称:bimini,代码行数:48,代码来源:menu-item.php


示例16: _envato_menu_page


//.........这里部分代码省略.........
                     $content .= '<h3>' . $title . ' ' . $version . ' by ' . $author . '</h3>';
                     /* Theme Description */
                     if ($description) {
                         $content .= '<p class="description">' . $description . '</p>';
                     }
                     /* Theme Backup URI */
                     $theme_backup_uri = $this->_get_theme_backup_uri($template);
                     /* Links list */
                     if ($stylesheet && $template && $current_stylesheet !== $stylesheet) {
                         $links[] = '<a href="' . $activate_url . '" class="activatelink" title="' . esc_attr(sprintf(__('Activate &#8220;%s&#8221;', 'envato'), $title)) . '">' . __('Activate', 'envato') . '</a>';
                         $links[] = '<a href="' . $preview_url . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', 'envato'), $title)) . '">' . __('Preview', 'envato') . '</a>';
                         $links[] = '<a href="' . $delete_url . '" class="submitdelete deletion" title="' . esc_attr(sprintf(__('Delete &#8220;%s&#8221;', 'envato'), $title)) . '" ' . $delete_onclick . '>' . __('Delete') . '</a>';
                         $links[] = '<a href="' . $details_url . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('View version %1$s details', 'envato'), $latest_version)) . '">' . esc_attr(sprintf(__('View version %1$s details', 'envato'), $latest_version)) . '</a>';
                         if (!empty($theme_backup_uri)) {
                             $links[] = '<a href="' . $theme_backup_uri . '" title="' . esc_attr(__('Download Backup', 'envato')) . '">' . esc_attr(__('Download Backup', 'envato')) . '</a>';
                         }
                         $content .= '<div class="update-info">' . implode(' | ', $links) . '</div>';
                     }
                     /**
                      * This ugly code lists the current theme options
                      * It was pulled from wp-admin/themes.php with minor tweaks
                      */
                     if ($current_stylesheet == $stylesheet) {
                         global $submenu;
                         $parent_file = 'themes.php';
                         $options = array();
                         if (is_array($submenu) && isset($submenu['themes.php'])) {
                             foreach ((array) $submenu['themes.php'] as $item) {
                                 if ('themes.php' == $item[2] || 'theme-editor.php' == $item[2]) {
                                     continue;
                                 }
                                 if (!empty($submenu[$item[2]])) {
                                     $submenu[$item[2]] = array_values($submenu[$item[2]]);
                                     $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
                                     if (file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) {
                                         $options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
                                     } else {
                                         $options[] = "<a href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
                                     }
                                 } else {
                                     if (current_user_can($item[1])) {
                                         if (file_exists(ABSPATH . 'wp-admin/' . $item[2])) {
                                             $options[] = "<a href='{$item[2]}'>{$item[0]}</a>";
                                         } else {
                                             $options[] = "<a href='themes.php?page={$item[2]}'>{$item[0]}</a>";
                                         }
                                     }
                                 }
                             }
                         }
                         if (!empty($theme_backup_uri)) {
                             $options[] = '<a href="' . $theme_backup_uri . '" title="' . esc_attr(__('Download Backup', 'envato')) . '">' . esc_attr(__('Download Backup', 'envato')) . '</a>';
                         }
                         if (!empty($options)) {
                             $content .= '<div class="update-info"><span>' . __('Options:', 'envato') . '</span> ' . implode(' | ', $options) . '</div>';
                         }
                     }
                     /* Theme path information */
                     if (current_user_can('edit_themes') && $installed) {
                         if ($parent_theme) {
                             $content .= '<p>' . sprintf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.', 'envato'), $title, str_replace(WP_CONTENT_DIR, '', $template_dir), str_replace(WP_CONTENT_DIR, '', $stylesheet_dir), $title, $parent_theme) . '</p>';
                         } else {
                             $content .= '<p>' . sprintf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.', 'envato'), $title, str_replace(WP_CONTENT_DIR, '', $template_dir), str_replace(WP_CONTENT_DIR, '', $stylesheet_dir)) . '</p>';
                         }
                     }
                     /* Tags list */
开发者ID:prosenjit-itobuz,项目名称:nutraperfect,代码行数:67,代码来源:index.php


示例17: theme_is_current_screen

/**
 * Alternative to get_current_screen()
 * @link http://wordpress.stackexchange.com/a/174596/22728
 * 
 * @param  string $base      
 * @param  string $post_type 
 * @return bool
 */
function theme_is_current_screen($base = null, $post_type = null)
{
    if (!$base && !$post_type) {
        return false;
    }
    $screen = function_exists('get_current_screen') ? get_current_screen() : null;
    if (!$screen) {
        // Fake it.
        $screen = new StdClass();
        $screen->post_type = $screen->base = '';
        global $pagenow;
        if ($pagenow == 'admin-ajax.php') {
            if (isset($_REQUEST['action'])) {
                $screen->base = $_REQUEST['action'];
            }
        } else {
            $screen->post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : '';
            if ($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') {
                $screen->base = preg_replace('/[^a-z].+$/', '', $pagenow);
                if (!$screen->post_type) {
                    $screen->post_type = get_post_type(theme_get_post_id());
                }
            } else {
                $page_hook = '';
                global $plugin_page;
                if (!empty($plugin_page)) {
                    if ($screen->post_type) {
                        $the_parent = $pagenow . '?post_type=' . $screen->post_type;
                    } else {
                        $the_parent = $pagenow;
                    }
                    if (!($page_hook = get_plugin_page_hook($plugin_page, $the_parent))) {
                        $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
                    }
                }
                $screen->base = $page_hook ? $page_hook : pathinfo($pagenow, PATHINFO_FILENAME);
            }
        }
    }
    // The base type of the screen. This is typically the same as $id but with any post types and taxonomies stripped.
    if ($base) {
        if (!is_array($base)) {
            $base = array($base);
        }
        if (!in_array($screen->base, $base)) {
            return false;
        }
    }
    if ($post_type) {
        if (!is_array($post_type)) {
            $post_type = array($post_type);
        }
        if (!in_array($screen->post_type, $post_type)) {
            return false;
        }
    }
    return true;
}
开发者ID:bdwebteam,项目名称:WP-CodeSpring,代码行数:66,代码来源:functions.php


示例18: _wp_menu_output

/**
 * Display menu.
 *
 * @access private
 * @since 2.7.0
 *
 * @param array $menu
 * @param array $submenu
 * @param bool $submenu_as_parent
 */
function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
	global $self, $parent_file, $submenu_file, $plugin_page, $pagenow, $typenow;

	$first = true;
	// 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
	foreach ( $menu as $key => $item ) {
		$admin_is_parent = false;
		$class = array();
		if ( $first ) {
			$class[] = 'wp-first-item';
			$first = false;
		}
		if ( !empty($submenu[$item[2]]) )
			$class[] = 'wp-has-submenu';

		if ( ( $parent_file && $item[2] == $parent_file ) || ( f 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_plugin_page_hookname函数代码示例发布时间:2022-05-15
下一篇:
PHP get_plugin_list_with_function函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap