Index: trunk/extensions/CustomUserSignup/CustomUserTemplate.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | function msg( $str ) { |
18 | 18 | // exists |
19 | 19 | if( $this->campaign && wfMessage( "customusertemplate-{$this->campaign}-$str" )->exists() ) { |
20 | | - $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str" ); |
| 20 | + $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str", true ); |
21 | 21 | } else { |
22 | 22 | parent::msg( $str ); |
23 | 23 | } |
— | — | @@ -25,21 +25,27 @@ |
26 | 26 | function msgWiki( $str ) { |
27 | 27 | // exists |
28 | 28 | if( $this->campaign && wfMessage( "customusertemplate-{$this->campaign}-$str" )->exists() ) { |
29 | | - $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str" ); |
| 29 | + $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str", false ); |
30 | 30 | } else { |
31 | 31 | parent::msgWiki( $str ); |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | | - function msgWikiCustom( $str ) { |
| 35 | + function msgWikiCustom( $str, $checkifplain ) { |
36 | 36 | global $wgParser, $wgOut; |
37 | 37 | |
38 | 38 | $text = $this->translator->translate( $str ); |
39 | 39 | $parserOutput = $wgParser->parse( $text, $wgOut->getTitle(), |
40 | 40 | $wgOut->parserOptions(), true ); |
41 | | - echo $parserOutput->getText(); |
| 41 | + $parsedText = $parserOutput->getText(); |
| 42 | + if( $checkifplain && |
| 43 | + ( strlen(strip_tags($parsedText)) == (strlen($parsedText)-7) )) { |
| 44 | + echo htmlspecialchars( $text ); |
| 45 | + } else { |
| 46 | + echo $parsedText; |
| 47 | + } |
42 | 48 | } |
43 | | - |
| 49 | + |
44 | 50 | } |
45 | 51 | |
46 | 52 | class CustomUsercreateTemplate extends UsercreateTemplate { |
— | — | @@ -57,7 +63,7 @@ |
58 | 64 | function msg( $str ) { |
59 | 65 | // exists |
60 | 66 | if( $this->campaign && wfMessage( "customusertemplate-{$this->campaign}-$str" )->exists() ) { |
61 | | - $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str" ); |
| 67 | + $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str", true ); |
62 | 68 | } else { |
63 | 69 | parent::msg( $str ); |
64 | 70 | } |
— | — | @@ -66,18 +72,25 @@ |
67 | 73 | function msgWiki( $str ) { |
68 | 74 | // exists |
69 | 75 | if( $this->campaign && wfMessage( "customusertemplate-{$this->campaign}-$str" )->exists() ) { |
70 | | - $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str" ); |
| 76 | + $this->msgWikiCustom( "customusertemplate-{$this->campaign}-$str", false ); |
71 | 77 | } else { |
72 | 78 | parent::msgWiki( $str ); |
73 | 79 | } |
74 | 80 | } |
75 | 81 | |
76 | | - function msgWikiCustom( $str ) { |
| 82 | + function msgWikiCustom( $str, $checkifplain ) { |
77 | 83 | global $wgParser, $wgOut; |
78 | 84 | |
79 | 85 | $text = $this->translator->translate( $str ); |
80 | 86 | $parserOutput = $wgParser->parse( $text, $wgOut->getTitle(), |
81 | 87 | $wgOut->parserOptions(), true ); |
82 | | - echo $parserOutput->getText(); |
| 88 | + $parsedText = $parserOutput->getText(); |
| 89 | + if( $checkifplain && |
| 90 | + ( strlen(strip_tags($parsedText)) == (strlen($parsedText)-7) )) { |
| 91 | + echo htmlspecialchars( $text ); |
| 92 | + } else { |
| 93 | + echo $parsedText; |
| 94 | + } |
83 | 95 | } |
| 96 | + |
84 | 97 | } |
\ No newline at end of file |