File tree Expand file tree Collapse file tree 3 files changed +58
-10
lines changed Expand file tree Collapse file tree 3 files changed +58
-10
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ function jq_ui_api_versions () {
4
+ // Must be listed with newest first
5
+ return array (
6
+ "1.10 " => "1.6 and newer " ,
7
+ "1.9 " => "1.6 and newer " ,
8
+ "1.8 " => "1.3.2 and newer " ,
9
+ );
10
+ }
11
+
12
+ function jq_ui_api_version_latest () {
13
+ $ versions = jq_ui_api_versions ();
14
+ return key ( $ versions );
15
+ }
16
+
17
+ function jq_ui_api_version_current () {
18
+ $ thisVersion = explode ( "/ " , JQUERY_LIVE_SITE );
19
+ return count ( $ thisVersion ) === 2 ?
20
+ $ thisVersion [ 1 ] :
21
+ jq_ui_api_version_latest ();
22
+ }
Original file line number Diff line number Diff line change 2
2
get_header ();
3
3
the_post ();
4
4
5
- // Must be listed with newest first
6
- $ versions = array (
7
- "1.10 " => "1.6 and newer " ,
8
- "1.9 " => "1.6 and newer " ,
9
- "1.8 " => "1.3.2 and newer " ,
10
- );
11
-
12
- $ latestVersion = key ( $ versions );
13
- $ thisVersion = explode ( "/ " , JQUERY_LIVE_SITE );
14
- $ thisVersion = count ( $ thisVersion ) === 2 ? $ thisVersion [ 1 ] : $ latestVersion ;
5
+ $ versions = jq_ui_api_versions ();
6
+ $ latestVersion = jq_ui_api_version_latest ();
7
+ $ thisVersion = jq_ui_api_version_current ();
15
8
$ rootUrl = $ thisVersion === $ latestVersion ? '' : "/ $ thisVersion " ;
16
9
?>
17
10
Original file line number Diff line number Diff line change
1
+ <?php
2
+ $ versions = jq_ui_api_versions ();
3
+ $ thisVersion = jq_ui_api_version_current ();
4
+ $ latestVersion = jq_ui_api_version_latest ();
5
+ ?>
6
+
7
+ <div id="sidebar" class="widget-area" role="complementary">
8
+ <aside id="categories" class="widget">
9
+ <h3 class="widget-title">jQuery UI <?php echo $ thisVersion ; ?> </h3>
10
+ <ul>
11
+ <?php wp_list_categories ( array (
12
+ 'depth ' => 2 ,
13
+ 'title_li ' => '' ,
14
+ 'current_category ' => jq_post_category (),
15
+ 'use_desc_for_title ' => false
16
+ ) ); ?>
17
+ </ul>
18
+ </aside>
19
+
20
+ <aside id="categories" class="widget">
21
+ <h3 class="widget-title">Other Versions</h3>
22
+ <ul>
23
+ <?php foreach ( $ versions as $ version => $ _ ) {
24
+ if ( $ version === $ thisVersion ) {
25
+ continue ;
26
+ }
27
+
28
+ $ url = $ version === $ latestVersion ? '/ ' : "/ $ version/ " ;
29
+ echo "<li><a href= \"$ url \">jQuery UI $ version</a></li> " ;
30
+ } ?>
31
+ </ul>
32
+ </aside>
33
+ </div>
You can’t perform that action at this time.
0 commit comments