Index: trunk/extensions/SimpleSurvey/Surveys.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | 'business' => 'vitals-07-2010-answer-nonprof-business', |
44 | 44 | 'nothink' => 'vitals-07-2010-answer-nonprof-think', |
45 | 45 | ), |
46 | | - ), |
| 46 | + ), |
47 | 47 | 'wikimediafoundation' => array( |
48 | 48 | 'question' => 'vitals-07-2010-question-wikimedia', |
49 | 49 | 'type' => 'select', |
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.classes.php |
— | — | @@ -1,25 +1,25 @@ |
2 | | -<?php |
| 2 | +<?php |
3 | 3 | class SimpleSurvey extends PrefSwitchSurvey { |
4 | 4 | // Correlation between names of field types and implementation classes |
5 | 5 | /* Static Functions */ |
6 | | - |
| 6 | + |
7 | 7 | /* update schema*/ |
8 | | - public static function schema( ){ |
| 8 | + public static function schema( ) { |
9 | 9 | global $wgExtModifiedFields, $wgExtNewTables; |
10 | | - |
11 | | - $wgExtNewTables[] = array( 'prefswitch_survey', |
12 | | - dirname( dirname( __FILE__ ) ) ."/UsabilityInitiative/PrefSwitch/PrefSwitch.sql" |
| 10 | + |
| 11 | + $wgExtNewTables[] = array( 'prefswitch_survey', |
| 12 | + dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch/PrefSwitch.sql" |
13 | 13 | ); |
14 | | - |
| 14 | + |
15 | 15 | $wgExtModifiedFields[] = array( |
16 | 16 | 'prefswitch_survey', |
17 | 17 | 'pss_user', |
18 | 18 | dirname( __FILE__ ) . '/SimpleSurvey.patch-pssuser.sql' |
19 | 19 | ); |
20 | | - |
| 20 | + |
21 | 21 | return true; |
22 | 22 | } |
23 | | - |
| 23 | + |
24 | 24 | /** |
25 | 25 | * creates a random token |
26 | 26 | * @return a random token |
— | — | @@ -28,8 +28,8 @@ |
29 | 29 | global $wgUser; |
30 | 30 | return wfGenerateToken( array( $wgUser, time() ) ); |
31 | 31 | } |
32 | | - |
33 | | - |
| 32 | + |
| 33 | + |
34 | 34 | /** |
35 | 35 | * Render the HTML for a survey. |
36 | 36 | * @param $name string Survey name |
— | — | @@ -39,29 +39,29 @@ |
40 | 40 | */ |
41 | 41 | public static function render( $questions ) { |
42 | 42 | global $wgUser; |
43 | | - |
| 43 | + |
44 | 44 | $html = Xml::openElement( 'dl' ); |
45 | 45 | foreach ( $questions as $field => $config ) { |
46 | 46 | $answer = null; |
47 | 47 | $answerData = null; |
48 | 48 | $invisible = false; |
49 | | - if(isset($config['visibility']) && $config['visibility'] == 'hidden' ){ |
| 49 | + if ( isset( $config['visibility'] ) && $config['visibility'] == 'hidden' ) { |
50 | 50 | $invisible = true; |
51 | 51 | } |
52 | | - if($invisible){ |
53 | | - $html .= Xml::openElement( 'div', array("style" => "display:none;") ); |
| 52 | + if ( $invisible ) { |
| 53 | + $html .= Xml::openElement( 'div', array( "style" => "display:none;" ) ); |
54 | 54 | } |
55 | 55 | $html .= call_user_func( array( self::$fieldTypes[$config['type']], 'render' ), |
56 | 56 | $field, $config, $answer, $answerData |
57 | 57 | ); |
58 | | - if($invisible){ |
59 | | - $html .= Xml::closeElement('div'); |
| 58 | + if ( $invisible ) { |
| 59 | + $html .= Xml::closeElement( 'div' ); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | $html .= Xml::closeElement( 'dl' ); |
63 | 63 | return $html; |
64 | 64 | } |
65 | | - |
| 65 | + |
66 | 66 | /** |
67 | 67 | * Save a survey to the database |
68 | 68 | * @param $name string Survey name |
— | — | @@ -71,12 +71,12 @@ |
72 | 72 | global $wgRequest, $wgUser; |
73 | 73 | $dbw = wfGetDb( DB_MASTER ); |
74 | 74 | $now = $dbw->timestamp(); |
75 | | - $cookieID = $wgRequest->getCookie("vitals-survey"); |
76 | | - if($cookieID == null){ |
| 75 | + $cookieID = $wgRequest->getCookie( "vitals-survey" ); |
| 76 | + if ( $cookieID == null ) { |
77 | 77 | $cookieID = self::generateRandomCookieID(); |
78 | | - $wgRequest->response()->setcookie("vitals-survey", $cookieID); |
| 78 | + $wgRequest->response()->setcookie( "vitals-survey", $cookieID ); |
79 | 79 | } |
80 | | - |
| 80 | + |
81 | 81 | foreach ( $survey['questions'] as $question => $config ) { |
82 | 82 | $dbw->insert( |
83 | 83 | 'prefswitch_survey', |
— | — | @@ -92,8 +92,8 @@ |
93 | 93 | __METHOD__ |
94 | 94 | ); |
95 | 95 | } |
96 | | - |
97 | | - //pseudoquestion, logged in? IP address? |
| 96 | + |
| 97 | + // pseudoquestion, logged in? IP address? |
98 | 98 | $dbw->insert( |
99 | 99 | 'prefswitch_survey', |
100 | 100 | array( |
— | — | @@ -101,13 +101,13 @@ |
102 | 102 | 'pss_timestamp' => $now, |
103 | 103 | 'pss_name' => $name, |
104 | 104 | 'pss_question' => "logged_in", |
105 | | - 'pss_answer' => $wgUser->isLoggedIn()?"yes":"no", |
| 105 | + 'pss_answer' => $wgUser->isLoggedIn() ? "yes":"no", |
106 | 106 | 'pss_answer_data' => wfGetIP(), |
107 | 107 | ), |
108 | 108 | __METHOD__ |
109 | 109 | ); |
110 | | - |
111 | | - |
112 | | - |
| 110 | + |
| 111 | + |
| 112 | + |
113 | 113 | } |
114 | 114 | } |
\ No newline at end of file |
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.i18n.php |
— | — | @@ -11,40 +11,40 @@ |
12 | 12 | 'simple-survey-back' => 'Go back', |
13 | 13 | 'simple-survey-title' => 'Simple Survey', |
14 | 14 | 'simple-survey-confirm' => 'Thanks! Your data has been submitted.', |
15 | | - |
| 15 | + |
16 | 16 | /*vitals 07 2010 */ |
17 | 17 | 'simple-survey-intro-vitals-07-2010' => 'This is a quick survey to give us a better idea of who you are', |
18 | 18 | 'vitals-07-2010-submit' => 'Submit', |
19 | | - |
| 19 | + |
20 | 20 | 'vitals-07-2010-question-use' => 'How often do you use Wikipedia?', |
21 | 21 | 'vitals-07-2010-question-edit' => 'Do you edit Wikipedia?', |
22 | 22 | 'vitals-07-2010-question-nonprofit' => 'Did you know Wikipedia is a non-profit project?', |
23 | | - 'vitals-07-2010-question-wikimedia'=> 'Which of these describes your knowledge of the Wikimedia Foundation, the organization that hosts Wikipedia and its sister projects such as Wiktionary and Wikiquote:', |
24 | | - 'vitals-07-2010-question-age'=> 'Please tell us your age', |
| 23 | + 'vitals-07-2010-question-wikimedia' => 'Which of these describes your knowledge of the Wikimedia Foundation, the organization that hosts Wikipedia and its sister projects such as Wiktionary and Wikiquote:', |
| 24 | + 'vitals-07-2010-question-age' => 'Please tell us your age', |
25 | 25 | 'vitals-07-2010-question-programming' => 'Please tell us which one of these describes you:', |
26 | | - 'vitals-07-2010-question-gender'=> 'Please tell us your gender', |
27 | | - 'vitals-07-2010-question-story'=> 'We love hearing about ways Wikipedia has impacted your life! Please feel free to share any stories, explain any of your answers, or leave a comment for the Wikimedia Foundation here:', |
| 26 | + 'vitals-07-2010-question-gender' => 'Please tell us your gender', |
| 27 | + 'vitals-07-2010-question-story' => 'We love hearing about ways Wikipedia has impacted your life! Please feel free to share any stories, explain any of your answers, or leave a comment for the Wikimedia Foundation here:', |
28 | 28 | 'vitals-07-2010-question-computerexp' => "Which one of the following describes your computer experience?", |
29 | 29 | |
30 | | - 'vitals-07-2010-blank'=> '', |
31 | | - 'vitals-07-2010-answer-daily'=> 'Daily', |
32 | | - 'vitals-07-2010-answer-weekly'=> 'Weekly', |
33 | | - 'vitals-07-2010-answer-monthly'=> 'Monthly', |
34 | | - 'vitals-07-2010-answer-rarely'=> 'less than monthly', |
35 | | - 'vitals-07-2010-answer-firsttime'=> 'This was my first time', |
36 | | - 'vitals-07-2010-answer-never'=> 'Never', |
| 30 | + 'vitals-07-2010-blank' => '', |
| 31 | + 'vitals-07-2010-answer-daily' => 'Daily', |
| 32 | + 'vitals-07-2010-answer-weekly' => 'Weekly', |
| 33 | + 'vitals-07-2010-answer-monthly' => 'Monthly', |
| 34 | + 'vitals-07-2010-answer-rarely' => 'less than monthly', |
| 35 | + 'vitals-07-2010-answer-firsttime' => 'This was my first time', |
| 36 | + 'vitals-07-2010-answer-never' => 'Never', |
37 | 37 | |
38 | 38 | 'vitals-07-2010-answer-y-daily' => 'Yes, daily', |
39 | 39 | 'vitals-07-2010-answer-y-weekly' => 'Yes, weekly', |
40 | 40 | 'vitals-07-2010-answer-y-monthly' => 'Yes, monthly', |
41 | 41 | 'vitals-07-2010-answer-y-rarely' => 'Yes, but less than monthly', |
42 | 42 | 'vitals-07-2010-answer-n-never' => 'No, never', |
43 | | - 'vitals-07-2010-answer-dunno-edit'=> "I didn't know you could edit", |
44 | | - |
| 43 | + 'vitals-07-2010-answer-dunno-edit' => "I didn't know you could edit", |
| 44 | + |
45 | 45 | 'vitals-07-2010-answer-nonprof-knew' => "I knew it was a non-profit", |
46 | 46 | 'vitals-07-2010-answer-nonprof-business' => "I assumed it was a for-profit business", |
47 | 47 | 'vitals-07-2010-answer-nonprof-think' => "I've never thought about it", |
48 | | - |
| 48 | + |
49 | 49 | 'vitals-07-2010-answer-never-heard' => "I've never heard of it", |
50 | 50 | 'vitals-07-2010-answer-heard-nothing' => "I guess I've heard of it, but don't know anything about it", |
51 | 51 | 'vitals-07-2010-answer-hosted' => "I know that Wikipedia is hosted by the Wikimedia Foundation, but that's about it", |
— | — | @@ -55,8 +55,8 @@ |
56 | 56 | 'vitals-07-2010-answer-many-lang' => "I am comfortable with many programming languages", |
57 | 57 | 'vitals-07-2010-answer-no-lang' => "Programming? Not me!", |
58 | 58 | |
59 | | - 'vitals-07-2010-answer-male'=> 'Male', |
60 | | - 'vitals-07-2010-answer-female'=> 'Female', |
61 | | - 'vitals-07-2010-answer-other'=> 'Other', |
| 59 | + 'vitals-07-2010-answer-male' => 'Male', |
| 60 | + 'vitals-07-2010-answer-female' => 'Female', |
| 61 | + 'vitals-07-2010-answer-other' => 'Other', |
62 | 62 | ); |
63 | 63 | |
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.php |
— | — | @@ -2,9 +2,9 @@ |
3 | 3 | |
4 | 4 | $dir = dirname( __FILE__ ) . '/'; |
5 | 5 | |
6 | | -//from prefswitch in usability initiative |
| 6 | +// from prefswitch in usability initiative |
7 | 7 | require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/UsabilityInitiative.php" ); |
8 | | -$prefswitchdir = dirname( dirname( __FILE__ ) ) ."/UsabilityInitiative/PrefSwitch"; |
| 8 | +$prefswitchdir = dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch"; |
9 | 9 | |
10 | 10 | // Adds Autoload Classes |
11 | 11 | $wgAutoloadClasses = array_merge( |
— | — | @@ -19,13 +19,13 @@ |
20 | 20 | 'PrefSwitchSurveyFieldDimensions' => $prefswitchdir . '/PrefSwitch.classes.php', |
21 | 21 | 'PrefSwitchSurveyFieldText' => $prefswitchdir . '/PrefSwitch.classes.php', |
22 | 22 | 'SimpleSurvey' => $dir . "SimpleSurvey.classes.php", |
23 | | - 'SpecialSimpleSurvey' => $dir. 'SpecialSimpleSurvey.php', |
| 23 | + 'SpecialSimpleSurvey' => $dir . 'SpecialSimpleSurvey.php', |
24 | 24 | ) |
25 | 25 | ); |
26 | | -unset($prefswitchdir); |
| 26 | +unset( $prefswitchdir ); |
27 | 27 | |
28 | 28 | |
29 | | -//add special pages |
| 29 | +// add special pages |
30 | 30 | $wgSpecialPages['SimpleSurvey'] = 'SpecialSimpleSurvey'; |
31 | 31 | $wgSpecialPageGroups['SimpleSurvey'] = 'wiki'; |
32 | 32 | $wgExtensionMessagesFiles['SimpleSurvey'] = $dir . 'SimpleSurvey.i18n.php'; |
— | — | @@ -44,9 +44,9 @@ |
45 | 45 | |
46 | 46 | $wgValidSurveys = array(); |
47 | 47 | |
48 | | -//add surveys |
49 | | -require_once($dir . "Surveys.php"); |
50 | | -unset($dir); |
| 48 | +// add surveys |
| 49 | +require_once( $dir . "Surveys.php" ); |
| 50 | +unset( $dir ); |
51 | 51 | |
52 | 52 | // Always include the browser stuff... |
53 | 53 | foreach ( $wgPrefSwitchSurveys as $survey ) { |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | 'ie8' => 'prefswitch-survey-answer-browser-ie8', |
63 | 63 | 'ff1' => 'prefswitch-survey-answer-browser-ff1', |
64 | 64 | 'ff2' => 'prefswitch-survey-answer-browser-ff2', |
65 | | - 'ff3'=> 'prefswitch-survey-answer-browser-ff3', |
| 65 | + 'ff3' => 'prefswitch-survey-answer-browser-ff3', |
66 | 66 | 'cb' => 'prefswitch-survey-answer-browser-cb', |
67 | 67 | 'c1' => 'prefswitch-survey-answer-browser-c1', |
68 | 68 | 'c2' => 'prefswitch-survey-answer-browser-c2', |
Index: trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | class SpecialSimpleSurvey extends SpecialPage { |
11 | 11 | |
12 | 12 | /* Private Members */ |
13 | | - |
| 13 | + |
14 | 14 | private $origin = ''; |
15 | 15 | private $originTitle = null; |
16 | 16 | private $originQuery = ''; |
— | — | @@ -19,51 +19,51 @@ |
20 | 20 | private $tokenToCheck = ''; |
21 | 21 | |
22 | 22 | /* Functions */ |
23 | | - |
| 23 | + |
24 | 24 | /** |
25 | 25 | * Quick token matching wrapper for form processing |
26 | 26 | */ |
27 | 27 | public function checkToken() { |
28 | 28 | global $wgRequest; |
29 | 29 | $this->tokenToCheck = $_SESSION['wsSimpleSurveyToken']; |
30 | | - if($this->tokenToCheck != "" && |
31 | | - ( $wgRequest->getVal( 'token' ) == $this->tokenToCheck ) ){ |
| 30 | + if ( $this->tokenToCheck != "" && |
| 31 | + ( $wgRequest->getVal( 'token' ) == $this->tokenToCheck ) ) { |
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | else return false; |
35 | 35 | } |
36 | | - |
37 | | - public function setToken(){ |
| 36 | + |
| 37 | + public function setToken() { |
38 | 38 | $this->tokenToCheck = wfGenerateToken( array( $this, time() ) ); |
39 | 39 | $_SESSION['wsSimpleSurveyToken'] = $this->tokenToCheck; |
40 | 40 | } |
41 | | - |
| 41 | + |
42 | 42 | public function __construct() { |
43 | 43 | parent::__construct( 'SimpleSurvey' ); |
44 | 44 | wfLoadExtensionMessages( 'SimpleSurvey' ); |
45 | 45 | } |
46 | | - |
47 | | - |
| 46 | + |
| 47 | + |
48 | 48 | public function execute( $par ) { |
49 | 49 | global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, $wgPrefSwitchStyleVersion, $wgValidSurveys, $wgSimpleSurveyRedirectURL; |
50 | 50 | $this->setHeaders(); |
51 | 51 | // Set page title |
52 | 52 | $wgOut->setPageTitle( wfMsg( 'simple-survey-title' ) ); |
53 | | - $surveyName = $wgRequest->getVal("survey"); |
54 | | - |
55 | | - if($wgRequest->wasPosted()){ |
56 | | - if($surveyName && in_array($surveyName,$wgValidSurveys ) && $this->checkToken() ){ |
| 53 | + $surveyName = $wgRequest->getVal( "survey" ); |
| 54 | + |
| 55 | + if ( $wgRequest->wasPosted() ) { |
| 56 | + if ( $surveyName && in_array( $surveyName, $wgValidSurveys ) && $this->checkToken() ) { |
57 | 57 | SimpleSurvey::save( $surveyName, $wgPrefSwitchSurveys[$surveyName] ); |
58 | | - $wgOut->addHtml("<b>" . wfMsg( 'simple-survey-confirm' ). "</b>"); |
| 58 | + $wgOut->addHtml( "<b>" . wfMsg( 'simple-survey-confirm' ) . "</b>" ); |
59 | 59 | } |
60 | | - //forward to new page |
61 | | - if($wgSimpleSurveyRedirectURL){ |
62 | | - $wgRequest->response()->header("Location: $wgSimpleSurveyRedirectURL"); |
63 | | - } |
64 | | - |
| 60 | + // forward to new page |
| 61 | + if ( $wgSimpleSurveyRedirectURL ) { |
| 62 | + $wgRequest->response()->header( "Location: $wgSimpleSurveyRedirectURL" ); |
| 63 | + } |
| 64 | + |
65 | 65 | return; |
66 | 66 | } |
67 | | - |
| 67 | + |
68 | 68 | $this->setToken(); |
69 | 69 | // Get the origin from the request |
70 | 70 | $par = $wgRequest->getVal( 'from', $par ); |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | // $this->originTitle should never be Special:Userlogout |
73 | 73 | if ( |
74 | 74 | $this->originTitle && |
75 | | - $this->originTitle->isSpecial('Userlogout') |
| 75 | + $this->originTitle->isSpecial( 'Userlogout' ) |
76 | 76 | ) { |
77 | 77 | $this->originTitle = null; |
78 | 78 | } |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $this->originLinkUrl = $this->originTitle->getLinkUrl( $this->originQuery ); |
85 | 85 | $this->originFullUrl = $this->originTitle->getFullUrl( $this->originQuery ); |
86 | 86 | } |
87 | | - |
| 87 | + |
88 | 88 | // Begin output |
89 | 89 | $this->setHeaders(); |
90 | 90 | UsabilityInitiativeHooks::initialize(); |
— | — | @@ -91,29 +91,29 @@ |
92 | 92 | UsabilityInitiativeHooks::addStyle( 'PrefSwitch/PrefSwitch.css', $wgPrefSwitchStyleVersion ); |
93 | 93 | $wgOut->addHtml( '<div class="plainlinks">' ); |
94 | 94 | // Handle various modes |
95 | | - |
96 | | - $this->render( $wgRequest->getVal("survey") ); |
97 | | - |
| 95 | + |
| 96 | + $this->render( $wgRequest->getVal( "survey" ) ); |
| 97 | + |
98 | 98 | $wgOut->addHtml( '</div>' ); |
99 | 99 | } |
100 | | - |
| 100 | + |
101 | 101 | /* Private Functions */ |
102 | | - |
| 102 | + |
103 | 103 | private function render( $mode = null ) { |
104 | 104 | global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgValidSurveys; |
105 | 105 | // Make sure links will retain the origin |
106 | 106 | $query = array( 'from' => $this->origin, 'fromquery' => $this->originQuery ); |
107 | | - |
108 | | - if ( !isset( $wgPrefSwitchSurveys[$mode] ) && !in_array($mode, $wgValidSurveys) ){ |
| 107 | + |
| 108 | + if ( !isset( $wgPrefSwitchSurveys[$mode] ) && !in_array( $mode, $wgValidSurveys ) ) { |
109 | 109 | $wgOut->addWikiMsg( "simple-survey-invalid" ); |
110 | | - if ( $this->originTitle ) { |
| 110 | + if ( $this->originTitle ) { |
111 | 111 | $wgOut->addHTML( wfMsg( "simple-survey-back", $this->originLink ) ); |
112 | 112 | } |
113 | 113 | return; |
114 | 114 | } |
115 | | - |
| 115 | + |
116 | 116 | $wgOut->addWikiMsg( "simple-survey-intro-{$mode}" ); |
117 | | - |
| 117 | + |
118 | 118 | // Setup a form |
119 | 119 | $html = Xml::openElement( |
120 | 120 | 'form', array( |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | $html .= Xml::hidden( 'survey', $mode ); |
128 | | - $html .= Xml::hidden( 'token', $this->tokenToCheck); |
| 128 | + $html .= Xml::hidden( 'token', $this->tokenToCheck ); |
129 | 129 | // Render a survey |
130 | 130 | $html .= SimpleSurvey::render( |
131 | 131 | $wgPrefSwitchSurveys[$mode]['questions'] |
— | — | @@ -137,6 +137,6 @@ |
138 | 138 | ); |
139 | 139 | $html .= Xml::closeElement( 'dt' ); |
140 | 140 | $html .= Xml::closeElement( 'form' ); |
141 | | - $wgOut->addHtml( $html ); |
| 141 | + $wgOut->addHtml( $html ); |
142 | 142 | } |
143 | 143 | } |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
— | — | @@ -1,35 +1,35 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -//settings |
| 4 | +// settings |
5 | 5 | |
6 | | -//number of reviews |
| 6 | +// number of reviews |
7 | 7 | $wgArticleAssessmentRevisionCutoff = 5; |
8 | 8 | |
9 | | -//Number of "ratings" to store. Allows it to be a bit more dynamic |
| 9 | +// Number of "ratings" to store. Allows it to be a bit more dynamic |
10 | 10 | $wgArticleAssessmentRatingCount = 4; |
11 | 11 | |
12 | | -//Auto-load files |
| 12 | +// Auto-load files |
13 | 13 | $dir = dirname( __FILE__ ) . '/'; |
14 | 14 | $wgAutoloadClasses['ApiListArticleAssessment'] = $dir . 'api/ApiListArticleAssessment.php'; |
15 | 15 | $wgAutoloadClasses['ApiArticleAssessment'] = $dir . 'api/ApiArticleAssessment.php'; |
16 | 16 | $wgAutoloadClasses['ArticleAssessmentPilotHooks'] = $dir . 'ArticleAssessmentPilot.hooks.php'; |
17 | 17 | |
18 | | -//Schema and tables |
| 18 | +// Schema and tables |
19 | 19 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleAssessmentPilotHooks::schema'; |
20 | 20 | $wgHooks['ParserTestTables'][] = 'ArticleAssessmentPilotHooks::parserTestTables'; |
21 | 21 | |
22 | | -//Hooks |
| 22 | +// Hooks |
23 | 23 | $wgHooks['SkinAfterContent'][] = 'ArticleAssessmentPilotHooks::addCode'; |
24 | 24 | |
25 | | -//API modules |
| 25 | +// API modules |
26 | 26 | $wgAPIListModules['articleassessment'] = 'ApiListArticleAssessment'; |
27 | 27 | $wgAPIModules['articleassessment'] = 'ApiArticleAssessment'; |
28 | 28 | |
29 | | -//i18n and aliases |
| 29 | +// i18n and aliases |
30 | 30 | // Adds Internationalized Messages |
31 | 31 | $wgExtensionMessagesFiles['ArticleAssessmentPilot'] = $dir . 'ArticleAssessmentPilot.i18n.php'; |
32 | 32 | |
33 | | -//Credits |
| 33 | +// Credits |
34 | 34 | $wgExtensionCredits['other'][] = array( |
35 | 35 | 'path' => __FILE__, |
36 | 36 | 'name' => 'Article Assessment Pilot', |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | 'article_assessment', |
18 | 18 | dirname( __FILE__ ) . '/ArticleAssessmentPilot.sql' |
19 | 19 | ); |
20 | | - |
| 20 | + |
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | |
— | — | @@ -34,17 +34,17 @@ |
35 | 35 | |
36 | 36 | public static function addCode( &$data, $skin ) { |
37 | 37 | $title = $skin->getTitle(); |
38 | | - |
39 | | - //check if this page should have the form |
40 | | - |
41 | | - //Chances are we only want to be rating Mainspace, right? |
| 38 | + |
| 39 | + // check if this page should have the form |
| 40 | + |
| 41 | + // Chances are we only want to be rating Mainspace, right? |
42 | 42 | if ( $title->getNamespace() !== NS_MAIN ) { |
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | |
46 | | - //write the form |
| 46 | + // write the form |
47 | 47 | |
48 | | - //if user has no cookie, set cookie |
| 48 | + // if user has no cookie, set cookie |
49 | 49 | |
50 | 50 | return true; |
51 | 51 | } |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * |
5 | 4 | * |
| 5 | + * |
6 | 6 | * @file |
7 | 7 | * @ingroup API |
8 | 8 | */ |
— | — | @@ -12,31 +12,31 @@ |
13 | 13 | |
14 | 14 | public function execute() { |
15 | 15 | $params = $this->extractRequestParams(); |
16 | | - |
| 16 | + |
17 | 17 | $result = $this->getResult(); |
18 | | - |
| 18 | + |
19 | 19 | $this->addTables( 'article_assessment_pages' ); |
20 | 20 | $this->addTables( 'article_assessment_ratings' ); |
21 | | - |
| 21 | + |
22 | 22 | $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aam_rating' ) ); |
23 | 23 | |
24 | 24 | $this->addWhereFld( 'aap_rating_id', 'aam_rating_id' ); |
25 | | - |
| 25 | + |
26 | 26 | if ( isset( $params['pageid'] ) ) { |
27 | 27 | $this->addWhereFld( 'aa_page_id', $params['pageid'] ); |
28 | 28 | } |
29 | | - |
| 29 | + |
30 | 30 | $res = $this->select( __METHOD__ ); |
31 | 31 | |
32 | 32 | $assessments = array(); |
33 | | - |
34 | | - foreach( $res as $row ) { |
| 33 | + |
| 34 | + foreach ( $res as $row ) { |
35 | 35 | if ( !isset( $assessments[$row->aap_page_id] ) ) { |
36 | 36 | $assessments[$row->aap_page_id] = array( |
37 | 37 | 'pageid' => $row->aap_page_id, |
38 | 38 | ); |
39 | 39 | } |
40 | | - |
| 40 | + |
41 | 41 | $assessments[$row->aap_page_id]['ratings']['r' . $row->aap_rating] = array( |
42 | 42 | 'ratingid' => $row->aap_rating_id, |
43 | 43 | 'ratingdesc' => $row->aam_rating, |
— | — | @@ -45,10 +45,10 @@ |
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
49 | | - foreach( $assessments as $ass ) { |
| 49 | + foreach ( $assessments as $ass ) { |
50 | 50 | $result->addValue( array( 'query', $this->getModuleName() ), null, $ass ); |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'aa' ); |
54 | 54 | } |
55 | 55 | |
— | — | @@ -69,12 +69,12 @@ |
70 | 70 | 'List all article assessments' |
71 | 71 | ); |
72 | 72 | } |
73 | | - |
| 73 | + |
74 | 74 | public function getPossibleErrors() { |
75 | 75 | return array_merge( parent::getPossibleErrors(), array( |
76 | | - )); |
| 76 | + ) ); |
77 | 77 | } |
78 | | - |
| 78 | + |
79 | 79 | protected function getExamples() { |
80 | 80 | return array( |
81 | 81 | 'api.php?action=query&list=articleassessment', |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | $dbr = wfGetDB( DB_SLAVE ); |
15 | 15 | |
16 | | - //TODO:Refactor out...? |
| 16 | + // TODO:Refactor out...? |
17 | 17 | $res = $dbr->select( |
18 | 18 | 'article_assessment', |
19 | 19 | array( 'aa_rating_id', 'aa_rating_value' ), |
— | — | @@ -31,17 +31,17 @@ |
32 | 32 | $lastRatings[$row->aa_rating_id] = $row->aa_rating_value; |
33 | 33 | } |
34 | 34 | |
35 | | - //Do for each metric/dimension |
| 35 | + // Do for each metric/dimension |
36 | 36 | |
37 | 37 | $pageId = $params['pageid']; |
38 | 38 | $revisionId = $params['revid']; |
39 | 39 | |
40 | | - //TODO: Fold for loop into foreach above? |
| 40 | + // TODO: Fold for loop into foreach above? |
41 | 41 | global $wgArticleAssessmentRatingCount; |
42 | | - for ($i = 1; $i <= $wgArticleAssessmentRatingCount; $i++){ |
| 42 | + for ( $i = 1; $i <= $wgArticleAssessmentRatingCount; $i++ ) { |
43 | 43 | $lastRating = 0; |
44 | | - if ( isset( $lastRatings[$i]) ) { |
45 | | - $lastRating = $lastRatings[$i]; |
| 44 | + if ( isset( $lastRatings[$i] ) ) { |
| 45 | + $lastRating = $lastRatings[$i]; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $thisRating = 0; |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | $this->insertOrUpdateUserRatings( $pageId, $revisionId, $userName, $i, $thisRating ); |
58 | 58 | } |
59 | 59 | |
60 | | - //Insert (or update) a users rating for a revision |
| 60 | + // Insert (or update) a users rating for a revision |
61 | 61 | |
62 | 62 | $r = array(); |
63 | 63 | $r['result'] = 'Success'; |