Index: trunk/extensions/CreditTab/CreditTab.i18n.php |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | $messages['en'] = array( |
18 | 18 | 'credits-desc' => 'Adds a link to credits', |
19 | 19 | 'credits-tab' => 'Credits', |
20 | | - 'credits-tab-title' => 'Credits for this page', |
| 20 | + 'credits-tab-title' => 'Credits for this page', |
21 | 21 | ); |
22 | 22 | |
23 | 23 | /** Message documentation (Message documentation) */ |
24 | 24 | $messages['qqq'] = array( |
25 | 25 | 'credits-desc' => 'Description for Special:Version', |
26 | 26 | 'credits-tab' => 'Label of the tab that is shown by this extension', |
27 | | - 'credits-tab-title' => 'Title of the link that is shown when hovering (Tool-Tip)', |
| 27 | + 'credits-tab-title' => 'Tool tip of the link shown in the "credits" tab', |
28 | 28 | ); |
29 | 29 | |
30 | 30 | /** Arabic (العربية) |
Index: trunk/extensions/CreditTab/CreditTab.php |
— | — | @@ -30,57 +30,56 @@ |
31 | 31 | |
32 | 32 | function addAuthorHeadLink ( &$out, &$sk ) { |
33 | 33 | $out->addLink( array( |
34 | | - 'rel' => 'author', |
35 | | - 'type' => 'text/html', |
36 | | - 'title' => wfMsg('credits-tab'), |
37 | | - 'href' => $out->getTitle()->getLocalURL( 'action=credits' ), |
| 34 | + 'rel' => 'author', |
| 35 | + 'type' => 'text/html', |
| 36 | + 'title' => wfMsg( 'credits-tab' ), |
| 37 | + 'href' => $out->getTitle()->getLocalURL( 'action=credits' ), |
38 | 38 | ) ); |
39 | 39 | return true; |
40 | 40 | } |
41 | 41 | |
42 | 42 | function displayTab( $obj, &$links ) { |
43 | | - // the old '$content_actions' array is thankfully just a |
44 | | - // sub-array of this one |
45 | | - $views_links = $links['views']; |
46 | | - showCredits( $obj, $views_links ); |
47 | | - $links['views'] = $views_links; |
48 | | - return true; |
49 | | - } |
| 43 | + // the old '$content_actions' array is thankfully just a |
| 44 | + // sub-array of this one |
| 45 | + $views_links = $links['views']; |
| 46 | + showCredits( $obj, $views_links ); |
| 47 | + $links['views'] = $views_links; |
| 48 | + return true; |
| 49 | +} |
| 50 | + |
50 | 51 | function showCredits( $obj, &$content_actions ) { |
51 | 52 | global $wgRequest, $wgCreditTabNamespaces; |
52 | 53 | if ( method_exists ( $obj, 'getTitle' ) ) { |
53 | | - $title = $obj->getTitle(); |
54 | | - } else { |
55 | | - $title = $obj->mTitle; |
56 | | - } |
| 54 | + $title = $obj->getTitle(); |
| 55 | + } else { |
| 56 | + $title = $obj->mTitle; |
| 57 | + } |
57 | 58 | wfLoadExtensionMessages('CreditTab'); |
58 | 59 | $ctNamespace = $title->getNamespace(); |
59 | 60 | $ctInsert=false; |
60 | | - if (count($wgCreditTabNamespaces)>0) { |
61 | | - if (in_array($ctNamespace, $wgCreditTabNamespaces)) { |
62 | | - $ctInsert=true; |
| 61 | + if ( count( $wgCreditTabNamespaces ) > 0 ) { |
| 62 | + if ( in_array( $ctNamespace, $wgCreditTabNamespaces ) ) { |
| 63 | + $ctInsert = true; |
63 | 64 | } |
64 | | - if (is_bool($wgCreditTabNamespaces)) { |
65 | | - $ctInsert=$wgCreditTabNamespaces; |
| 65 | + if ( is_bool( $wgCreditTabNamespaces ) ) { |
| 66 | + $ctInsert = $wgCreditTabNamespaces; |
66 | 67 | } |
67 | | - } |
68 | | - else { |
| 68 | + } else { |
69 | 69 | if ($title->isContentPage()) { |
70 | 70 | $ctInsert=true; |
71 | | - } |
72 | | - else { |
| 71 | + } else { |
73 | 72 | $ctInsert=false; |
74 | 73 | } |
75 | 74 | } |
76 | 75 | |
77 | 76 | $class_name = ( $wgRequest->getVal( 'action' ) == 'credits' ) ? 'selected' : ''; |
78 | | - if( $title->exists() && $ctInsert) { |
79 | | - $credit_tab = array( |
80 | | - 'class' => $class_name, |
81 | | - 'text' => wfMsg('credits-tab'), |
82 | | - 'title' => wfMsg('credits-tab-title'), |
83 | | - 'href' => $title->getLocalURL( 'action=credits' ), |
84 | | - ); |
| 77 | + if ( $title->exists() && $ctInsert ) { |
| 78 | + $credit_tab = array( |
| 79 | + 'class' => $class_name, |
| 80 | + 'text' => wfMsg( 'credits-tab' ), |
| 81 | + 'title' => wfMsg( 'credits-tab-title' ), |
| 82 | + 'href' => $title->getLocalURL( 'action=credits' ), |
| 83 | + ); |
85 | 84 | // find the location of the 'edit' tab, and add |
86 | 85 | // 'edit with form' right before it. |
87 | 86 | // this is a "key-safe" splice - it preserves |
— | — | @@ -93,7 +92,7 @@ |
94 | 93 | $tab_values = array_values( $content_actions ); |
95 | 94 | $edit_tab_location = array_search('history', $tab_keys); |
96 | 95 | $edit_tab_location++; |
97 | | - // If there's no 'edit' tab, look for the 'view source' tab |
| 96 | + // If there's no 'edit' tab, look for the 'view source' tab |
98 | 97 | // instead. |
99 | 98 | if ( $edit_tab_location == null ) { |
100 | 99 | $edit_tab_location = array_search( 'viewsource', $tab_keys ); |
— | — | @@ -105,11 +104,13 @@ |
106 | 105 | if ( $edit_tab_location == null ) { |
107 | 106 | $edit_tab_location = - 1; |
108 | 107 | } |
109 | | - array_splice($tab_keys, $edit_tab_location, 0, 'credits'); |
110 | | - array_splice($tab_values, $edit_tab_location, 0, array($credit_tab)); |
| 108 | + array_splice( $tab_keys, $edit_tab_location, 0, 'credits' ); |
| 109 | + array_splice( $tab_values, $edit_tab_location, 0, array( $credit_tab ) ); |
111 | 110 | $content_actions = array(); |
112 | | - for ($i = 0; $i < count($tab_keys); $i++) |
113 | | - $content_actions[$tab_keys[$i]] = $tab_values[$i]; |
| 111 | + $tabCnt = count( $tab_keys ); |
| 112 | + for ( $i = 0; $i < $tabCnt; $i++ ) { |
| 113 | + $content_actions[ $tab_keys[$i] ] = $tab_values[$i]; |
| 114 | + } |
114 | 115 | } |
115 | | - return true; |
| 116 | + return true; |
116 | 117 | } |