Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3933,22 +3933,30 @@ |
3934 | 3934 | /** |
3935 | 3935 | * Fetch the user's signature text, if any, and normalize to |
3936 | 3936 | * validated, ready-to-insert wikitext. |
| 3937 | + * If you have pre-fetched the nickname or the fancySig option, you can |
| 3938 | + * specify them here to save a database query. |
3937 | 3939 | * |
3938 | 3940 | * @param User $user |
3939 | 3941 | * @return string |
3940 | | - * @private |
3941 | 3942 | */ |
3942 | | - function getUserSig( &$user ) { |
| 3943 | + function getUserSig( &$user, $nickname = false, $fancySig = null ) { |
3943 | 3944 | global $wgMaxSigChars; |
3944 | 3945 | |
3945 | 3946 | $username = $user->getName(); |
3946 | | - $nickname = $user->getOption( 'nickname' ); |
| 3947 | + |
| 3948 | + // If not given, retrieve from the user object. |
| 3949 | + if ( $nickname === false ) |
| 3950 | + $nickname = $user->getOption( 'nickname' ); |
| 3951 | + |
| 3952 | + if ( is_null( $fancySig ) ) |
| 3953 | + $fancySig = $user->getBoolOption( 'fancysig' ); |
| 3954 | + |
3947 | 3955 | $nickname = $nickname == null ? $username : $nickname; |
3948 | 3956 | |
3949 | 3957 | if( mb_strlen( $nickname ) > $wgMaxSigChars ) { |
3950 | 3958 | $nickname = $username; |
3951 | 3959 | wfDebug( __METHOD__ . ": $username has overlong signature.\n" ); |
3952 | | - } elseif( $user->getBoolOption( 'fancysig' ) !== false ) { |
| 3960 | + } elseif( $fancySig !== false ) { |
3953 | 3961 | # Sig. might contain markup; validate this |
3954 | 3962 | if( $this->validateSig( $nickname ) !== false ) { |
3955 | 3963 | # Validated; clean up (if needed) and return it |