Index: trunk/extensions/Favorites/Favorites.php |
— | — | @@ -22,11 +22,12 @@ |
23 | 23 | 'name' => 'Favorites', |
24 | 24 | 'author' => 'Jeremy Lemley', |
25 | 25 | 'descriptionmsg' => 'favorites-desc', |
26 | | - 'version' => '0.2.2', |
| 26 | + 'version' => '0.2.6', |
27 | 27 | 'url' => "http://www.mediawiki.org/wiki/Extension:Favorites", |
28 | 28 | ); |
29 | 29 | |
30 | | -global $wgUseIconFavorite; |
| 30 | +global $wgUseIconFavorite, $wgFavoritesPersonalURL; |
| 31 | + |
31 | 32 | $dir = dirname(__FILE__) . '/'; |
32 | 33 | $wgExtensionMessagesFiles['Favorites'] = $dir . 'favorites.i18n.php'; |
33 | 34 | $wgAutoloadClasses['Favorites'] = $dir . 'Favorites_body.php'; |
— | — | @@ -62,7 +63,32 @@ |
63 | 64 | $wgHooks['TitleMoveComplete'][] = 'fnHookMoveToFav'; |
64 | 65 | $wgHooks['ArticleDeleteComplete'][] = 'fnHookDeleteFav'; |
65 | 66 | |
| 67 | +// Do we want to display a "My Favorites" link in the personal urls area? |
| 68 | +if ($wgFavoritesPersonalURL) { |
| 69 | + $wgHooks['PersonalUrls'][] = 'onAddPersonalUrls'; |
| 70 | +} |
66 | 71 | |
| 72 | +function onAddPersonalUrls( &$personal_urls, &$wgTitle ) { |
| 73 | + global $wgUser; |
| 74 | + |
| 75 | + // $skin = $wgUser->getSkin(); |
| 76 | + $title = Title::newFromText( 'Special:Favoritelist' ); |
| 77 | + if( $wgUser->getID() ) { |
| 78 | + $url['userpage'] = array_shift( $personal_urls ); |
| 79 | + $url[] = array_shift( $personal_urls ); |
| 80 | + $url[] = array_shift( $personal_urls ); |
| 81 | + |
| 82 | + $url[] = array( 'text' => wfMsg( 'myfavoritelist' ), |
| 83 | + 'href' => $title->getLocalURL( ) |
| 84 | + ); |
| 85 | + |
| 86 | + |
| 87 | + $personal_urls = $url + $personal_urls; |
| 88 | + } |
| 89 | + |
| 90 | + return true; |
| 91 | +} |
| 92 | + |
67 | 93 | function fnAction ($action, $article) { |
68 | 94 | $title = new Title(); |
69 | 95 | $favArticle = new FavArticle($title); |
— | — | @@ -106,8 +132,8 @@ |
107 | 133 | } |
108 | 134 | |
109 | 135 | function fnAddCss (&$out) { |
110 | | - global $wgScriptPath; |
111 | | - $out->addStyle($wgScriptPath. '/extensions/Favorites/favorites.css'); |
| 136 | + global $wgExtensionAssetsPath; |
| 137 | + $out->addStyle($wgExtensionAssetsPath . '/Favorites/favorites.css'); |
112 | 138 | return true; |
113 | 139 | } |
114 | 140 | |