Index: trunk/extensions/BreadCrumbs/BreadCrumbsFunctions.php |
— | — | @@ -25,11 +25,13 @@ |
26 | 26 | if( isset( $_SESSION['BreadCrumbs'] ) ) $m_BreadCrumbs = $_SESSION['BreadCrumbs']; |
27 | 27 | # cache index of last element: |
28 | 28 | $m_count = count( $m_BreadCrumbs ) - 1; |
29 | | - |
| 29 | + |
30 | 30 | # check for doubles: |
31 | | - if( $m_BreadCrumbs[ $m_count ] != $wgTitle->getPrefixedText() ) { |
32 | | - # reduce the array set, remove older elements: |
33 | | - $m_BreadCrumbs = array_slice( $m_BreadCrumbs, ( 1 - $wgBreadCrumbsCount ) ); |
| 31 | + if( $m_count < 1 || $m_BreadCrumbs[ $m_count ] != $wgTitle->getPrefixedText() ) { |
| 32 | + if( $m_count >= 1) { |
| 33 | + # reduce the array set, remove older elements: |
| 34 | + $m_BreadCrumbs = array_slice( $m_BreadCrumbs, ( 1 - $wgBreadCrumbsCount ) ); |
| 35 | + } |
34 | 36 | # add new page: |
35 | 37 | array_push( $m_BreadCrumbs, $wgTitle->getPrefixedText() ); |
36 | 38 | } |
— | — | @@ -37,7 +39,7 @@ |
38 | 40 | $_SESSION['BreadCrumbs'] = $m_BreadCrumbs; |
39 | 41 | # update cache: |
40 | 42 | $m_count = count( $m_BreadCrumbs ) - 1; |
41 | | - |
| 43 | + |
42 | 44 | # acquire a skin object: |
43 | 45 | $m_skin =& $wgUser->getSkin(); |
44 | 46 | # build the breadcrumbs trail: |
— | — | @@ -48,11 +50,11 @@ |
49 | 51 | } |
50 | 52 | $m_trail .= '</div>'; |
51 | 53 | $wgOut->addHTML( $m_trail ); |
52 | | - |
| 54 | + |
53 | 55 | # invalidate internal MediaWiki cache: |
54 | 56 | $wgTitle->invalidateCache(); |
55 | 57 | $wgUser->invalidateCache(); |
56 | | - |
| 58 | + |
57 | 59 | # Return true to let the rest work: |
58 | 60 | return true; |
59 | 61 | } |