web/wp-admin/menu-header.php
branchwordpress
changeset 109 03b0d1493584
child 132 4d4862461b8d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-admin/menu-header.php	Wed Dec 23 17:55:33 2009 +0000
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Displays Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The current page.
+ *
+ * @global string $self
+ * @name $self
+ * @var string
+ */
+$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
+$self = preg_replace('|^.*/plugins/|i', '', $self);
+
+global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+
+get_admin_page_parent();
+
+/**
+ * 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.
+				// This allows plugin pages with the same hook to exist under different parents.
+				} else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
+					$class[] = 'current';
+				}
+
+				$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
+
+				$menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
+				$sub_file = $sub_item[2];
+				if ( false !== $pos = strpos($sub_file, '?') )
+					$sub_file = substr($sub_file, 0, $pos);
+
+				if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
+					// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
+					
+					$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
+					if ( $parent_exists )
+						echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+					elseif ( 'admin.php' == $pagenow || !$parent_exists )
+						echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+					else
+						echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+				} else {
+					echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+				}
+			}
+			echo "</ul></div>";
+		}
+		echo "</li>";
+	}
+}
+
+?>
+
+<ul id="adminmenu">
+
+<?php
+
+_wp_menu_output( $menu, $submenu );
+do_action( 'adminmenu' );
+
+?>
+</ul>
4y` #L4 12 2 dd&M y#@MMi M4m!C)H2К`Sɩz'14h7_5eeVj.U`J{ U|E6lӌ! 0`%1UD(STDx), _Cv)0`˫CɚkDY,?V U.9i&s-UaV!ʯ$KCқ J+C*+U$_kٽouzYoZfr3y>'JoC_f{X8U+-yzeTecJ$}0#tzp'kdްEa*`]h07M% ~h`C|F]Ǩ`*}s 4݅u$-= M:P:>W{"A%ych` PׯkVǍ9ϟ,E} r0amR< ".*Ro7n]Rk˛>7Kw\3JEDBYDX"(@K(@ɩGʮ~K^:=o:׿=x=| 9Qlu1|? oZ"VO$}* `d2e C!xn 5cAt?huyxp6< Cà?xr85wP<Q8Er0zQltǨ:Q=GQp=F j sP4Kq "W20s `Q0`߸0s e ;C9qH)5 8l90`nE0` N 2h`#CCCT>HA< :ʇ-ØqCcCCP!aCPClm0667 (nXsp*CcCd5 HH{Cr=qZ"d;ai#cv0`a# G#c//1 !h`hhhlaX0v082Sh` T; aqUX0`P1ly!7 Ñn9! C*9Xnhq!⇈tPnp<  4<*a5Ut4< 1:y{2@nxg@!jf?lnZ$>>U*ʲݞvٟFW22E*8V jUZ0`GXnU9CP¬ UN mҮsī%9*ԇE[mT[!*uUJ*!eU:^}:]2u|ttJ3>nUB{Ѓ&t`(CjqnC!C"qa`4<Ƈw8u:#0:!4?;u"ACC(`r69>cA`d0t~atr:à|=r=CHp?C69nct!`lh|a`GA>{t>a:  Ue^ʽh=vU>CHP="^ yypAh,0h6C9yszC`l@6`S*^Zc|~Xp?;6>8CCC=F 1s 0r1#CChp: Cwa`wGA9cÑ: G~(p8r; C:P50|ơhhp0y hyGp0vFc|F|qG(9qlr2GQu#w4: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