Index: trunk/extensions/SocialProfile/UserProfile/UserProfile.php |
— | — | @@ -5,6 +5,8 @@ |
6 | 6 | |
7 | 7 | // Default setup for displaying sections |
8 | 8 | $wgUserPageChoice = true; |
| 9 | + |
| 10 | + |
9 | 11 | $wgUserProfileDisplay['friends'] = false; |
10 | 12 | $wgUserProfileDisplay['foes'] = false; |
11 | 13 | $wgUserProfileDisplay['gifts'] = true; |
— | — | @@ -38,11 +40,17 @@ |
39 | 41 | |
40 | 42 | $wgHooks['ArticleFromTitle'][] = 'wfUserProfileFromTitle'; |
41 | 43 | |
42 | | -// ArticleFromTitle |
43 | | -// Calls UserProfilePage instead of standard article |
| 44 | +/** |
| 45 | + * called by ArticleFromTitle hook |
| 46 | + * Calls UserProfilePage instead of standard article |
| 47 | + * |
| 48 | + * @param &$title Title object |
| 49 | + * @param &$article Article object |
| 50 | + * @return true |
| 51 | + */ |
44 | 52 | function wfUserProfileFromTitle( &$title, &$article ){ |
45 | | - global $wgUser, $wgRequest, $IP, $wgOut, $wgTitle, $wgSupressPageTitle, $wgSupressSubTitle, $wgMemc, |
46 | | - $wgUserPageChoice, $wgParser, $wgUserProfileDirectory, $wgUserProfileScripts, $wgStyleVersion; |
| 53 | + global $IP, $wgUser, $wgRequest, $wgOut, $wgTitle, $wgMemc, $wgStyleVersion, $wgHooks, |
| 54 | + $wgUserPageChoice, $wgUserProfileScripts; |
47 | 55 | |
48 | 56 | if ( strpos( $title->getText(), "/" ) === false && ( NS_USER == $title->getNamespace() || NS_USER_PROFILE == $title->getNamespace() ) ) { |
49 | 57 | |
— | — | @@ -59,21 +67,33 @@ |
60 | 68 | |
61 | 69 | if( !$show_user_page ){ |
62 | 70 | // Prevents editing of userpage |
63 | | - if( $wgRequest->getVal('action') == 'edit' ){ |
| 71 | + if( $wgRequest->getVal( 'action' ) == 'edit' ){ |
64 | 72 | $wgOut->redirect( $title->getFullURL() ); |
65 | 73 | } |
66 | 74 | } else { |
67 | | - $wgOut->enableClientCache(false); |
68 | | - $wgParser->disableCache(); |
| 75 | + $wgOut->enableClientCache( false ); |
| 76 | + $wgHooks['ParserLimitReport'][] = 'wfUserProfileMarkUncacheable'; |
69 | 77 | } |
70 | 78 | |
71 | | - $wgOut->addScript("<link rel='stylesheet' type='text/css' href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n"); |
| 79 | + $wgOut->addScript( "<link rel='stylesheet' type='text/css' href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n" ); |
72 | 80 | |
73 | 81 | $article = new UserProfilePage( $title ); |
74 | 82 | } |
75 | 83 | return true; |
76 | 84 | } |
77 | 85 | |
| 86 | +/** |
| 87 | + * Mark page as uncacheable |
| 88 | + * |
| 89 | + * @param $parser Parser object |
| 90 | + * @param &$limitReport String: unused |
| 91 | + * @return true |
| 92 | + */ |
| 93 | +function wfUserProfileMarkUncacheable( $parser, &$limitReport ) { |
| 94 | + $parser->disableCache(); |
| 95 | + return true; |
| 96 | +} |
| 97 | + |
78 | 98 | /* |
79 | 99 | //testing new hooks |
80 | 100 | $wgHooks['UserProfileBeginLeft'][] = 'wfUserProfileBeginTest'; |