Skip to content

Commit 5bb4f75

Browse files
nacinrdworth
authored andcommitted
Business in the front, party in the back.
(cherry picked from commit 4a2df97)
1 parent 7e79c15 commit 5bb4f75

File tree

1 file changed

+43
-31
lines changed

1 file changed

+43
-31
lines changed

themes/jquery/menu-header.php

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,10 @@
11
<?php
2-
3-
$tld = explode( '.', JQUERY_LIVE_SITE );
4-
$func = 'menu_header_' . implode( '_', $tld );
5-
if ( ! function_exists( $func ) ) {
6-
array_shift( $tld );
7-
$func = 'menu_header_' . implode( '_', $tld );
8-
}
9-
if ( function_exists( $func ) )
10-
jquery_render_menu( call_user_func( $func ) );
11-
unset( $tld, $func );
12-
13-
function jquery_render_menu( $items ) {
14-
$current = trailingslashit( set_url_scheme( 'http://' . JQUERY_LIVE_SITE . $_SERVER['REQUEST_URI'] ) );
15-
error_log( $current );
16-
?>
17-
<div class="menu-top-container">
18-
<ul id="menu-top" class="menu">
19-
<?php
20-
foreach ( $items as $url => $anchor ) {
21-
$class = 'menu-item';
22-
$url = set_url_scheme( $url );
23-
error_log( $url );
24-
if ( 0 === strpos( $current, $url ) )
25-
$class .= ' current';
26-
echo ' <li class="' . $class . '"><a href="' . $url . '">' . $anchor . "</a></li>\n";
27-
}
28-
?>
29-
</ul>
30-
</div>
31-
<?php
32-
}
2+
/*
3+
* The main header navigation menu for each project site.
4+
*
5+
* If a function exists for a subdomain (such as projects_jquery_com) it will
6+
* be used instead of the jquery_com function.
7+
*/
338

349
function menu_header_jquery_com() {
3510
return array(
@@ -81,3 +56,40 @@ function menu_header_jqueryui_com() {
8156
'http://jqueryui.com/about' => 'About',
8257
);
8358
}
59+
60+
61+
/*
62+
* Avert your eyes.
63+
*/
64+
65+
66+
$domain = explode( '.', JQUERY_LIVE_SITE );
67+
$func = 'menu_header_' . implode( '_', $domain );
68+
if ( ! function_exists( $func ) ) {
69+
array_shift( $domain );
70+
$func = 'menu_header_' . implode( '_', $domain );
71+
}
72+
if ( function_exists( $func ) )
73+
jquery_render_menu( call_user_func( $func ) );
74+
unset( $domain, $func );
75+
76+
function jquery_render_menu( $items ) {
77+
$current = trailingslashit( set_url_scheme( 'http://' . JQUERY_LIVE_SITE . $_SERVER['REQUEST_URI'] ) );
78+
error_log( $current );
79+
?>
80+
<div class="menu-top-container">
81+
<ul id="menu-top" class="menu">
82+
<?php
83+
foreach ( $items as $url => $anchor ) {
84+
$class = 'menu-item';
85+
$url = set_url_scheme( $url );
86+
error_log( $url );
87+
if ( 0 === strpos( $current, $url ) )
88+
$class .= ' current';
89+
echo ' <li class="' . $class . '"><a href="' . $url . '">' . $anchor . "</a></li>\n";
90+
}
91+
?>
92+
</ul>
93+
</div>
94+
<?php
95+
}

0 commit comments

Comments
 (0)