Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php |
— | — | @@ -32,36 +32,24 @@ |
33 | 33 | |
34 | 34 | $tabs = array(); |
35 | 35 | |
36 | | - $v = explode( '.', $wgVersion ); |
37 | | - if ( $v[0] > 1 || ( $v[0] == 1 && $v[1] >= 16 ) ) { |
38 | | - $parts = preg_split( '/(<h1.*?class="mw-headline".*?<\/h1>)/', $aboveandbelow[0], - 1, PREG_SPLIT_DELIM_CAPTURE ); |
39 | | - array_shift( $parts ); // don't need above part anyway |
| 36 | + $parts = preg_split( '/(<h1.*?class="mw-headline".*?<\/h1>)/', $aboveandbelow[0], - 1, PREG_SPLIT_DELIM_CAPTURE ); |
| 37 | + array_shift( $parts ); // don't need above part anyway |
40 | 38 | |
41 | | - for ( $i = 0; $i < ( count( $parts ) / 2 ); $i++ ) |
42 | | - { |
43 | | - preg_match( '/id="(.*?)"/', $parts[$i * 2], $matches ); |
44 | | - $tabid = $matches[1]; |
| 39 | + for ( $i = 0; $i < ( count( $parts ) / 2 ); $i++ ) { |
| 40 | + preg_match( '/id="(.*?)"/', $parts[$i * 2], $matches ); |
| 41 | + // Forward slashes in tab IDs cause a problem |
| 42 | + // in the jQuery UI tabs() function - just |
| 43 | + // replace them with an underline. |
| 44 | + $tabid = str_replace('/', '_', $matches[1]); |
45 | 45 | |
46 | | - preg_match( '/<span.*?class="mw-headline".*?>\s*(.*?)\s*<\/h1>/', $parts[$i * 2], $matches ); |
47 | | - $tabtitle = $matches[1]; |
| 46 | + preg_match( '/<span.*?class="mw-headline".*?>\s*(.*?)\s*<\/h1>/', $parts[$i * 2], $matches ); |
| 47 | + $tabtitle = $matches[1]; |
48 | 48 | |
49 | | - array_push( $tabs, array( |
50 | | - 'tabid' => $tabid, |
51 | | - 'title' => $tabtitle, |
52 | | - 'tabcontent' => $parts[$i * 2 + 1] |
53 | | - ) ); |
54 | | - } |
55 | | - } else { |
56 | | - $parts = preg_split( '/<a name="(.*?)"><\/a><h1>.*?<span class="mw-headline">\s*(.*?)\s*<\/span><\/h1>/', $aboveandbelow[0], - 1, PREG_SPLIT_DELIM_CAPTURE ); |
57 | | - array_shift( $parts ); // don't need above part anyway |
58 | | - |
59 | | - for ( $i = 0; $i < ( count( $parts ) / 3 ); $i++ ) { |
60 | | - array_push( $tabs, array( |
61 | | - 'tabid' => $parts[$i * 3], |
62 | | - 'title' => $parts[$i * 3 + 1], |
63 | | - 'tabcontent' => $parts[$i * 3 + 2] |
64 | | - ) ); |
65 | | - } |
| 49 | + array_push( $tabs, array( |
| 50 | + 'tabid' => $tabid, |
| 51 | + 'title' => $tabtitle, |
| 52 | + 'tabcontent' => $parts[$i * 2 + 1] |
| 53 | + ) ); |
66 | 54 | } |
67 | 55 | |
68 | 56 | $tabhtml = '<div id="headertabs">'; |