Index: trunk/extensions/CustomUserSignup/CustomUserSignup.php |
— | — | @@ -35,3 +35,21 @@ |
36 | 36 | $wgHooks['UserCreateForm'][] = 'CustomUserSignupHooks::userCreateForm'; |
37 | 37 | $wgHooks['UserLoginForm'][] = 'CustomUserSignupHooks::userCreateForm'; |
38 | 38 | $wgHooks['BeforeWelcomeCreation'][] = 'CustomUserSignupHooks::welcomeScreen'; |
| 39 | + |
| 40 | +// NOTE: This hook includes JS for the account creation project |
| 41 | +//$wgHooks['BeforePageDisplay'][] = 'CustomUserSignupHooks::beforePageDisplay'; |
| 42 | + |
| 43 | + |
| 44 | +// For Account Creation Project |
| 45 | +$cusResourceTemplate = array( |
| 46 | + 'localBasePath' => $dir . 'modules', |
| 47 | + 'remoteExtPath' => 'CustomUserSignup/modules', |
| 48 | +); |
| 49 | +$wgResourceModules['ext.AccountCreationUserBucket'] = array( |
| 50 | + 'scripts' => 'AccountCreationUserBucket.js', |
| 51 | + 'dependencies' => 'jquery.clickTracking', |
| 52 | +) + $cusResourceTemplate; |
| 53 | +$wgResourceModules['ext.UserBuckets']['dependencies'] = array_merge( |
| 54 | + ( array ) $wgResourceModules['ext.UserBuckets']['dependencies'], |
| 55 | + array('ext.AccountCreationUserBucket')); |
| 56 | + |
Index: trunk/extensions/CustomUserSignup/CustomUserSignup.hooks.php |
— | — | @@ -89,5 +89,9 @@ |
90 | 90 | } |
91 | 91 | return true; |
92 | 92 | } |
93 | | - |
| 93 | + |
| 94 | + public static function beforePageDisplay( $out, $skin ) { |
| 95 | + $out->addModules( 'ext.UserBuckets' ); |
| 96 | + return true; |
| 97 | + } |
94 | 98 | } |
\ No newline at end of file |
Index: trunk/extensions/CustomUserSignup/modules/AccountCreationUserBucket.js |
— | — | @@ -0,0 +1,55 @@ |
| 2 | + |
| 3 | +//checks |
| 4 | +if(typeof(MW) == "undefined"){ MW={};} |
| 5 | +if(!MW.activeCampaigns){ MW.activeCampaigns ={}; } |
| 6 | + |
| 7 | +//define new active campaign |
| 8 | +MW.activeCampaigns.AccountCreation = |
| 9 | + |
| 10 | +{ |
| 11 | + //Treatment name |
| 12 | + "name": "AccountCreation", |
| 13 | + |
| 14 | + //Treatment version. Increment this when altering rates |
| 15 | + "version": 1, |
| 16 | + |
| 17 | + // Rates are calculated out of the total sum, so |
| 18 | + // rates of x:10000, y:3, and z:1 mean users have a |
| 19 | + // chance of being in bucket x at 10000/10004, |
| 20 | + // y at 3/10004 and z at 1/10004 |
| 21 | + // The algorithm is faster if these are ordered in descending order, |
| 22 | + // particularly if there are orders of magnitude differences in the |
| 23 | + // bucket sizes |
| 24 | + // "none" is reserved for control |
| 25 | + "rates": {"NiceMsg1": 1, "NiceMsg2": 1 }, |
| 26 | + |
| 27 | + // individual changes, function names corresponding |
| 28 | + // to what is in "rates" object |
| 29 | + // (note: "none" function not needed or used) |
| 30 | + |
| 31 | + "NiceMsg1": function(){ |
| 32 | + //change to NiceMsg1 campaign |
| 33 | + $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg1" ); |
| 34 | + }, |
| 35 | + "NiceMsg2": function(){ |
| 36 | + //change to NiceMsg2 campaign |
| 37 | + $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg2" ); |
| 38 | + }, |
| 39 | + |
| 40 | + // "allActive" is reserved. |
| 41 | + // If this function exists, it will be apply to every user not in the "none" bucket |
| 42 | + "allActive": function(){ |
| 43 | + //add click tracking to save |
| 44 | + $j("#wpSave").click(function(){ $j.trackAction('save'); }); |
| 45 | + |
| 46 | + //track login attempt |
| 47 | + $j("#wpLoginAttempt").click(function(){ $j.trackAction('login-attempt'); }); |
| 48 | + |
| 49 | + //track account creation |
| 50 | + $j("#wpCreateaccount").click(function(){ $j.trackAction('account-created'); }); |
| 51 | + |
| 52 | + //add click tracking to preview |
| 53 | + $j("#wpPreview").click(function(){ $j.trackAction('preview'); }); |
| 54 | + } |
| 55 | + |
| 56 | +}; |
\ No newline at end of file |
Property changes on: trunk/extensions/CustomUserSignup/modules/AccountCreationUserBucket.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 57 | + native |
Index: trunk/extensions/CustomUserSignup/CustomUserTemplate.php |
— | — | @@ -39,7 +39,9 @@ |
40 | 40 | $wgOut->parserOptions(), true ); |
41 | 41 | $parsedText = $parserOutput->getText(); |
42 | 42 | if( $checkifplain && |
43 | | - ( strlen(strip_tags($parsedText)) == (strlen($parsedText)-7) )) { |
| 43 | + ( strlen(strip_tags($parsedText)) == (strlen($parsedText)-7) )) { |
| 44 | + // the parser encapsulates text in <p></p> (7 chars) If these |
| 45 | + // were the only chars added to the text, then it was plaintext |
44 | 46 | echo htmlspecialchars( $text ); |
45 | 47 | } else { |
46 | 48 | echo $parsedText; |
— | — | @@ -87,6 +89,8 @@ |
88 | 90 | $parsedText = $parserOutput->getText(); |
89 | 91 | if( $checkifplain && |
90 | 92 | ( strlen(strip_tags($parsedText)) == (strlen($parsedText)-7) )) { |
| 93 | + // the parser encapsulates text in <p></p> (7 chars) If these |
| 94 | + // were the only chars added to the text, then it was plaintext |
91 | 95 | echo htmlspecialchars( $text ); |
92 | 96 | } else { |
93 | 97 | echo $parsedText; |