Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php |
— | — | @@ -42,25 +42,25 @@ |
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | $this->createInstance(); |
46 | | - } else if ( $action == "delete" ) { |
| 46 | + } elseif ( $action == "delete" ) { |
47 | 47 | if ( ! $this->userLDAP->inProject( $project ) ) { |
48 | 48 | $this->notInProject(); |
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | $this->deleteInstance(); |
52 | | - } else if ( $action == "configure" ) { |
| 52 | + } elseif ( $action == "configure" ) { |
53 | 53 | if ( ! $this->userLDAP->inProject( $project ) ) { |
54 | 54 | $this->notInProject(); |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | $this->configureInstance(); |
58 | | - } else if ( $action == "reboot" ) { |
| 58 | + } elseif ( $action == "reboot" ) { |
59 | 59 | if ( ! $this->userLDAP->inProject( $project ) ) { |
60 | 60 | $this->notInProject(); |
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | $this->rebootInstance(); |
64 | | - } else if ( $action == "consoleoutput" ) { |
| 64 | + } elseif ( $action == "consoleoutput" ) { |
65 | 65 | if ( ! $this->userLDAP->inProject( $project ) ) { |
66 | 66 | $this->notInProject(); |
67 | 67 | return true; |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSecurityGroup.php |
— | — | @@ -35,15 +35,15 @@ |
36 | 36 | |
37 | 37 | if ( $action == "create" ) { |
38 | 38 | $this->createSecurityGroup(); |
39 | | - } else if ( $action == "delete" ) { |
| 39 | + } elseif ( $action == "delete" ) { |
40 | 40 | $this->deleteSecurityGroup(); |
41 | | - } else if ( $action == "configure" ) { |
| 41 | + } elseif ( $action == "configure" ) { |
42 | 42 | // Currently unsupported |
43 | 43 | #$this->configureSecurityGroup(); |
44 | 44 | $this->listSecurityGroups(); |
45 | | - } else if ( $action == "addrule" ) { |
| 45 | + } elseif ( $action == "addrule" ) { |
46 | 46 | $this->addRule(); |
47 | | - } else if ( $action == "removerule" ) { |
| 47 | + } elseif ( $action == "removerule" ) { |
48 | 48 | $this->removeRule(); |
49 | 49 | } else { |
50 | 50 | $this->listSecurityGroups(); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php |
— | — | @@ -32,15 +32,15 @@ |
33 | 33 | $action = $wgRequest->getVal( 'action' ); |
34 | 34 | if ( $action == "allocate" ) { |
35 | 35 | $this->allocateAddress(); |
36 | | - } else if ( $action == "release" ) { |
| 36 | + } elseif ( $action == "release" ) { |
37 | 37 | $this->releaseAddress(); |
38 | | - } else if ( $action == "associate" ) { |
| 38 | + } elseif ( $action == "associate" ) { |
39 | 39 | $this->associateAddress(); |
40 | | - } else if ( $action == "disassociate" ) { |
| 40 | + } elseif ( $action == "disassociate" ) { |
41 | 41 | $this->disassociateAddress(); |
42 | | - } else if ( $action == "addhost" ) { |
| 42 | + } elseif ( $action == "addhost" ) { |
43 | 43 | $this->addHost(); |
44 | | - } else if ( $action == "removehost" ) { |
| 44 | + } elseif ( $action == "removehost" ) { |
45 | 45 | $this->removehost(); |
46 | 46 | } else { |
47 | 47 | $this->listAddresses(); |
— | — | @@ -588,7 +588,7 @@ |
589 | 589 | } else { |
590 | 590 | $wgOut->addWikiMsg( 'openstackmanager-addhostfailed', $ip, $hostname ); |
591 | 591 | } |
592 | | - } else if ( $hostbyip ) { |
| 592 | + } elseif ( $hostbyip ) { |
593 | 593 | # We need to add an associateddomain, if the associateddomain doesn't already exist |
594 | 594 | $success = $hostbyip->addAssociatedDomain( $hostname . '.' . $domain->getFullyQualifiedDomainName() ); |
595 | 595 | if ( $success ) { |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php |
— | — | @@ -25,11 +25,11 @@ |
26 | 26 | $action = $wgRequest->getVal( 'action' ); |
27 | 27 | if ( $action == "create" ) { |
28 | 28 | $this->createProject(); |
29 | | - } else if ( $action == "delete" ) { |
| 29 | + } elseif ( $action == "delete" ) { |
30 | 30 | $this->deleteProject(); |
31 | | - } else if ( $action == "addmember" ) { |
| 31 | + } elseif ( $action == "addmember" ) { |
32 | 32 | $this->addMember(); |
33 | | - } else if ( $action == "deletemember" ) { |
| 33 | + } elseif ( $action == "deletemember" ) { |
34 | 34 | $this->deleteMember(); |
35 | 35 | } else { |
36 | 36 | $this->listProjects(); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaDomain.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | $action = $wgRequest->getVal( 'action' ); |
46 | 46 | if ( $action == "create" ) { |
47 | 47 | $this->createDomain(); |
48 | | - } else if ( $action == "delete" ) { |
| 48 | + } elseif ( $action == "delete" ) { |
49 | 49 | $this->deleteDomain(); |
50 | 50 | } else { |
51 | 51 | $this->listDomains(); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php |
— | — | @@ -42,19 +42,19 @@ |
43 | 43 | return true; |
44 | 44 | } |
45 | 45 | $this->createVolume(); |
46 | | - } else if ( $action == "delete" ) { |
| 46 | + } elseif ( $action == "delete" ) { |
47 | 47 | if ( ! $this->userLDAP->inProject( $project ) ) { |
48 | 48 | $this->notInProject(); |
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | $this->deleteVolume(); |
52 | | - } else if ( $action == "attach" ) { |
| 52 | + } elseif ( $action == "attach" ) { |
53 | 53 | if ( ! $this->userLDAP->inProject( $project ) ) { |
54 | 54 | $this->notInProject(); |
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | $this->attachVolume(); |
58 | | - } else if ( $action == "detach" ) { |
| 58 | + } elseif ( $action == "detach" ) { |
59 | 59 | if ( ! $this->userLDAP->inProject( $project ) ) { |
60 | 60 | $this->notInProject(); |
61 | 61 | return true; |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaKey.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | $action = $wgRequest->getVal( 'action' ); |
30 | 30 | if ( $action == "import" ) { |
31 | 31 | $this->importKey(); |
32 | | - } else if ( $action == "delete" ) { |
| 32 | + } elseif ( $action == "delete" ) { |
33 | 33 | $this->deleteKey(); |
34 | 34 | } else { |
35 | 35 | $this->listKeys(); |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | 'default' => $keyname, |
129 | 129 | 'name' => 'project', |
130 | 130 | ); |
131 | | - } else if ( $wgOpenStackManagerNovaKeypairStorage == 'ldap' ) { |
| 131 | + } elseif ( $wgOpenStackManagerNovaKeypairStorage == 'ldap' ) { |
132 | 132 | $hash = $wgRequest->getVal( 'hash' ); |
133 | 133 | $keypairs = $this->userLDAP->getKeypairs(); |
134 | 134 | if ( ! $wgRequest->wasPosted() ) { |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | } |
192 | 192 | $out .= Html::rawElement( 'table', array( 'id' => 'novakeylist', 'class' => 'wikitable sortable collapsible' ), $projectOut ); |
193 | 193 | } |
194 | | - } else if ( $wgOpenStackManagerNovaKeypairStorage == 'ldap' ) { |
| 194 | + } elseif ( $wgOpenStackManagerNovaKeypairStorage == 'ldap' ) { |
195 | 195 | $out .= $sk->link( $this->getTitle(), wfMsgHtml( 'openstackmanager-importkey' ), array(), array( 'action' => 'import' ) ); |
196 | 196 | $keypairs = $this->userLDAP->getKeypairs(); |
197 | 197 | $keysOut = ''; |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | return true; |
231 | 231 | } |
232 | 232 | $wgOut->addWikiMsg( 'openstackmanager-keypairimported' ); |
233 | | - } else if ( $wgOpenStackManagerNovaKeypairStorage == 'nova' ) { |
| 233 | + } elseif ( $wgOpenStackManagerNovaKeypairStorage == 'nova' ) { |
234 | 234 | # wgOpenStackManagerNovaKeypairStorage == 'nova' |
235 | 235 | # OpenStack's EC2 API doesn't yet support importing keys, use |
236 | 236 | # of this option isn't currently recommended |
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php |
— | — | @@ -46,10 +46,10 @@ |
47 | 47 | if ( $role == 'sysadmin' ) { |
48 | 48 | $wgOut->setPagetitle( wfMsg( 'openstackmanager-needsysadminrole' ) ); |
49 | 49 | $wgOut->addWikiMsg( 'openstackmanager-needsysadminrole2' ); |
50 | | - } else if ( $role == 'netadmin' ) { |
| 50 | + } elseif ( $role == 'netadmin' ) { |
51 | 51 | $wgOut->setPagetitle( wfMsg( 'openstackmanager-neednetadminrole' ) ); |
52 | 52 | $wgOut->addWikiMsg( 'openstackmanager-neednetadminrole2' ); |
53 | | - } else if ( $role == 'cloudadmin' ) { |
| 53 | + } elseif ( $role == 'cloudadmin' ) { |
54 | 54 | $wgOut->setPagetitle( wfMsg( 'openstackmanager-needcloudadminrole' ) ); |
55 | 55 | $wgOut->addWikiMsg( 'openstackmanager-needcloudadminrole2' ); |
56 | 56 | } |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaRole.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | $action = $wgRequest->getVal( 'action' ); |
27 | 27 | if ( $action == "addmember" ) { |
28 | 28 | $this->addMember(); |
29 | | - } else if ( $action == "deletemember" ) { |
| 29 | + } elseif ( $action == "deletemember" ) { |
30 | 30 | $this->deleteMember(); |
31 | 31 | } else { |
32 | 32 | $this->listGlobalRoles(); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSudoer.php |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | $action = $wgRequest->getVal( 'action' ); |
26 | 26 | if ( $action == "create" ) { |
27 | 27 | $this->createSudoer(); |
28 | | - } else if ( $action == "delete" ) { |
| 28 | + } elseif ( $action == "delete" ) { |
29 | 29 | $this->deleteSudoer(); |
30 | | - } else if ( $action == "modify" ) { |
| 30 | + } elseif ( $action == "modify" ) { |
31 | 31 | $this->modifySudoer(); |
32 | 32 | } else { |
33 | 33 | $this->listSudoers(); |
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | $domains = array(); |
136 | 136 | if ( $type == 'local' ) { |
137 | 137 | $query = '(&(soarecord=*)(l=*))'; |
138 | | - } else if ( $type == 'public' ) { |
| 138 | + } elseif ( $type == 'public' ) { |
139 | 139 | $query = '(&(soarecord=*)(!(l=*)))'; |
140 | 140 | } else { |
141 | 141 | $query = '(soarecord=*)'; |
Index: trunk/extensions/Reflect/server/api/ApiReflectAction.php |
— | — | @@ -1,9 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Reflect API for getting and posting summary bullets and responses. |
6 | | - * |
7 | | - * Note, many of the methods for handling Responses are almost near |
| 5 | + * Reflect API for getting and posting summary bullets and responses. |
| 6 | + * |
| 7 | + * Note, many of the methods for handling Responses are almost near |
8 | 8 | * duplicates of those handling Bullets. |
9 | 9 | */ |
10 | 10 | class ApiReflectAction extends ApiBase { |
— | — | @@ -27,9 +27,9 @@ |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Gets all the bullets and responses relevant for the given LQT threads. |
31 | | - * |
| 31 | + * |
32 | 32 | * The params listed below are the items posted in $params. |
33 | | - * @param $comments JSON encoded list of comment ids. |
| 33 | + * @param $comments JSON encoded list of comment ids. |
34 | 34 | * @return assoc array of commentIDs=>array(bullets = {bullet attributes, responses}) |
35 | 35 | */ |
36 | 36 | public function actionGetData( $params ) { |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | |
53 | 53 | foreach ( $curBullets as $curBullet ) { |
54 | 54 | // TODO: is it possible to make fewer DB calls? |
55 | | - $sel = array( 'bl_id as id', 'bl_timestamp as ts', |
| 55 | + $sel = array( 'bl_id as id', 'bl_timestamp as ts', |
56 | 56 | 'bl_user as u', 'bl_text as txt' ); |
57 | 57 | |
58 | 58 | // TODO: create a Bullet model class for abstracting this away |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | foreach ( $highlights as $highlight ) { |
73 | 73 | $bullet->highlights[] = $highlight; |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | $curResponses = $dbr->select( |
77 | 77 | $table = 'reflect_response_current', |
78 | 78 | $vars = array( 'rsp_id', 'rsp_rev_id' ), |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | foreach ( $curResponses as $curResponse ) { |
83 | 83 | $response = $dbr->selectRow( |
84 | 84 | $table = 'reflect_response_revision', |
85 | | - $vars = array( 'rsp_id as id', 'rsp_timestamp as ts', |
| 85 | + $vars = array( 'rsp_id as id', 'rsp_timestamp as ts', |
86 | 86 | 'rsp_user as u', 'rsp_text as txt', 'rsp_signal as sig' ), |
87 | 87 | $conds = 'rsp_rev_id = ' . $curResponse->rsp_rev_id ); |
88 | 88 | $response->rev = $curResponse->rsp_rev_id; |
— | — | @@ -99,9 +99,9 @@ |
100 | 100 | /** |
101 | 101 | * Deletes a response by removing it from the current responses table. |
102 | 102 | * A record of the response is still kept in the response revisions table. |
103 | | - * |
| 103 | + * |
104 | 104 | * The params listed below are the items posted in $params. |
105 | | - * @param $response_id |
| 105 | + * @param $response_id |
106 | 106 | * @return db's return from delete |
107 | 107 | */ |
108 | 108 | private function deleteResponse( $params ) { |
— | — | @@ -118,11 +118,11 @@ |
119 | 119 | /** |
120 | 120 | * Deletes a bullet by removing it from the current bullets table. |
121 | 121 | * A record of the bullet is still kept in the bullet revisions table. |
122 | | - * |
| 122 | + * |
123 | 123 | * The params listed below are the items posted in $params. |
124 | | - * @param $bullet_id |
| 124 | + * @param $bullet_id |
125 | 125 | * @return db's return from delete |
126 | | - */ |
| 126 | + */ |
127 | 127 | private function deleteBullet( $params ) { |
128 | 128 | $dbw = wfGetDB( DB_MASTER ); |
129 | 129 | |
— | — | @@ -134,16 +134,16 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | | - * Adds a new bullet or modifies an existing bullet. |
139 | | - * |
| 138 | + * Adds a new bullet or modifies an existing bullet. |
| 139 | + * |
140 | 140 | * The params listed below are the items posted in $params. |
141 | 141 | * @param $comment_id |
142 | 142 | * @param $bullet_id If set to valid bullet_id, signals a modification |
143 | 143 | * @param $text The bullet text |
144 | 144 | * @param $highlights Array of sentence ids that the bullet refers to |
145 | | - * |
| 145 | + * |
146 | 146 | * @return assoc array with $insert_id as the bullet id and $rev_id as the new rev id |
147 | | - */ |
| 147 | + */ |
148 | 148 | private function addBullet( $params ) { |
149 | 149 | $dbw = wfGetDB( DB_MASTER ); |
150 | 150 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -155,9 +155,9 @@ |
156 | 156 | |
157 | 157 | $bulletText = $params['text']; |
158 | 158 | if ( $bulletText == '' ) { |
159 | | - return ''; |
| 159 | + return ''; |
160 | 160 | } |
161 | | - |
| 161 | + |
162 | 162 | $modify = isset( $params['bullet_id'] ); |
163 | 163 | |
164 | 164 | if ( $modify ) { |
— | — | @@ -166,10 +166,10 @@ |
167 | 167 | /* |
168 | 168 | * w/o lock, the following could lead to a race condition |
169 | 169 | * TODO: should $wgAntiLockFlags be used here? |
170 | | - */ |
| 170 | + */ |
171 | 171 | $dbw->begin(); // start transaction |
172 | 172 | $res = $dbr->query( |
173 | | - 'SELECT MAX(bl_id)+1 AS next_bullet_id FROM ' . |
| 173 | + 'SELECT MAX(bl_id)+1 AS next_bullet_id FROM ' . |
174 | 174 | $dbr->tableName( 'reflect_bullet_revision' ) |
175 | 175 | ); |
176 | 176 | $bulletID = $res->fetchRow(); |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | } |
195 | 195 | |
196 | 196 | if ( isset( $params['highlights'] ) ) { |
197 | | - $highlights = json_decode( str_replace( '\\', '', |
| 197 | + $highlights = json_decode( str_replace( '\\', '', |
198 | 198 | $params['highlights'] ) ); |
199 | 199 | $highlightsToInsert = array(); |
200 | 200 | |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | 'hl_element' => $value->eid, |
206 | 206 | ); |
207 | 207 | } |
208 | | - |
| 208 | + |
209 | 209 | $dbw->insert( "reflect_highlight", $highlightsToInsert ); |
210 | 210 | } |
211 | 211 | |
— | — | @@ -223,9 +223,9 @@ |
224 | 224 | } |
225 | 225 | |
226 | 226 | /* send email notification to commenter that someone bulleted their point |
227 | | - * |
228 | | - * TODO: consider possibility of someone submitting harmless bullet, |
229 | | - * getting it approved, then modifying it maliciously. By not sending |
| 227 | + * |
| 228 | + * TODO: consider possibility of someone submitting harmless bullet, |
| 229 | + * getting it approved, then modifying it maliciously. By not sending |
230 | 230 | * notification on modification (as below), the commenter is opened to risk. |
231 | 231 | */ |
232 | 232 | global $wgReflectEnotif; |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | $threadObj = Threads::withId( $commentID ); |
235 | 235 | $to = $threadObj->author(); |
236 | 236 | $catalystUser = $wgUser; |
237 | | - $this->sendMail( $threadObj, $to, $catalystUser, |
| 237 | + $this->sendMail( $threadObj, $to, $catalystUser, |
238 | 238 | 'reflect-bulleted', array( $params['text'] ), array() ); |
239 | 239 | } |
240 | 240 | return array( "insert_id" => $bulletID, "rev_id" => $bulletRev, "u" => $user ); |
— | — | @@ -241,8 +241,8 @@ |
242 | 242 | |
243 | 243 | |
244 | 244 | /** |
245 | | - * Adds a new response or modifies an existing response. |
246 | | - * |
| 245 | + * Adds a new response or modifies an existing response. |
| 246 | + * |
247 | 247 | * The params listed below are the items posted in $params. |
248 | 248 | * @param $comment_id |
249 | 249 | * @param $bullet_id The bullet to which this response addresses |
— | — | @@ -250,9 +250,9 @@ |
251 | 251 | * @param $response_id If set to valid bullet_id, signals a modification |
252 | 252 | * @param $text The bullet text |
253 | 253 | * @param $signal The accuracy rating for the respective bullet |
254 | | - * |
| 254 | + * |
255 | 255 | * @return assoc array with $insert_id as the bullet id and $rev_id as the new rev id |
256 | | - */ |
| 256 | + */ |
257 | 257 | function addResponse( $params ) { |
258 | 258 | $dbw = wfGetDB( DB_MASTER ); |
259 | 259 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | $commentID = $params['comment_id']; |
266 | 266 | |
267 | 267 | $responseText = $params['text']; |
268 | | - if ( $responseText == '' ){ |
| 268 | + if ( $responseText == '' ){ |
269 | 269 | return ''; |
270 | 270 | } |
271 | 271 | |
— | — | @@ -277,11 +277,11 @@ |
278 | 278 | /* |
279 | 279 | * w/o lock, the following could lead to a race condition |
280 | 280 | * TODO: should $wgAntiLockFlags be used here? |
281 | | - */ |
| 281 | + */ |
282 | 282 | $dbw->begin(); // start transaction |
283 | | - |
| 283 | + |
284 | 284 | $res = $dbr->query( |
285 | | - 'select MAX(rsp_id)+1 as next_rsp_id from ' . |
| 285 | + 'select MAX(rsp_id)+1 as next_rsp_id from ' . |
286 | 286 | $dbr->tableName( 'reflect_response_revision' ) |
287 | 287 | ); |
288 | 288 | $responseID = $res->fetchRow(); |
— | — | @@ -299,14 +299,14 @@ |
300 | 300 | 'rsp_signal' => $signal |
301 | 301 | )); |
302 | 302 | $responseRev = $dbw->insertId(); |
303 | | - |
| 303 | + |
304 | 304 | if (!$modify){ |
305 | 305 | $dbw->commit(); // end transaction |
306 | 306 | } |
307 | 307 | |
308 | 308 | if ( $modify ) { |
309 | 309 | /* shouldn't lead to race condition as long as |
310 | | - * only commenters can update their responses (DEFAULT) */ |
| 310 | + * only commenters can update their responses (DEFAULT) */ |
311 | 311 | $dbw->update( $table = 'reflect_response_current', |
312 | 312 | $values = array( 'rsp_rev_id' => $responseRev ), |
313 | 313 | $conds = array( 'rsp_id =' . $responseID ) ); |
— | — | @@ -323,39 +323,39 @@ |
324 | 324 | $vars = array( 'bl_user as user', 'bl_text as text' ), |
325 | 325 | $conds = 'bl_rev_id = ' . $params['bullet_rev'] ); |
326 | 326 | |
327 | | - /* send email notification to bullet author that someone |
| 327 | + /* send email notification to bullet author that someone |
328 | 328 | * rated the accuracy of their bullet */ |
329 | 329 | global $wgReflectEnotif; |
330 | 330 | if ($wgReflectEnotif && !$modify) { |
331 | 331 | $threadObj = Threads::withId( $commentID ); |
332 | 332 | $to = User::newFromName( $bullet->user ); |
333 | 333 | $catalystUser = $threadObj->author(); |
334 | | - $this->sendMail( $threadObj, $to, $catalystUser, 'reflect-responded', |
| 334 | + $this->sendMail( $threadObj, $to, $catalystUser, 'reflect-responded', |
335 | 335 | array( $responseText, $bullet->text ), array() ); |
336 | 336 | } |
337 | | - return array( "insert_id" => $responseID, "rev_id" => $responseRev, |
| 337 | + return array( "insert_id" => $responseID, "rev_id" => $responseRev, |
338 | 338 | "u" => $user, "sig" => $signal ); |
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | 342 | * Sends a Reflect email in response to a new bullet or response. |
343 | | - * |
| 343 | + * |
344 | 344 | * @param $threadObj A reference to the relevant LQT Thread |
345 | 345 | * @param $to A User object to whom the email will be sent |
346 | 346 | * @param $catalystUser A User object who triggered this series of events |
347 | 347 | * @param $msgType The name of the message type to be used in accessing localized msg |
348 | 348 | * @param $bodyParams Additional parameters to be used in the sprintf of the body text |
349 | 349 | * @param $subjectParams Additional parameters to be used in the sprintf of the subject text |
350 | | - * |
351 | | - */ |
352 | | - private function sendMail( $threadObj, $to, $catalystUser, |
353 | | - $msgType, $bodyParams, $subjectParams ) |
| 350 | + * |
| 351 | + */ |
| 352 | + private function sendMail( $threadObj, $to, $catalystUser, |
| 353 | + $msgType, $bodyParams, $subjectParams ) |
354 | 354 | { |
355 | 355 | global $wgPasswordSender, $wgLanguageCode; |
356 | 356 | |
357 | 357 | // TODO: create Reflect mailing preferences for individuals & respect them |
358 | 358 | if ( !$to ) { |
359 | | - return; |
| 359 | + return; |
360 | 360 | } |
361 | 361 | |
362 | 362 | $from = new MailAddress( $wgPasswordSender, 'WikiAdmin' ); |
— | — | @@ -365,7 +365,7 @@ |
366 | 366 | $bodyParams = array_merge( $params, $bodyParams ); |
367 | 367 | $subjectParams = array_merge( $params, $subjectParams ); |
368 | 368 | $msg = wfMsgReal( $msgType, $bodyParams, true, $wgLanguageCode, true ); |
369 | | - $subject = wfMsgReal( $msgType . '-subject', $subjectParams, |
| 369 | + $subject = wfMsgReal( $msgType . '-subject', $subjectParams, |
370 | 370 | true, $wgLanguageCode, true ); |
371 | 371 | |
372 | 372 | UserMailer::send( new MailAddress( $to ), $from, $subject, $msg ); |
— | — | @@ -374,74 +374,74 @@ |
375 | 375 | /** |
376 | 376 | * Handles the bullet posts. Calls appropriate private helper functions |
377 | 377 | * for deletes and adds. Makes sure user has permission to perform requested |
378 | | - * actions. |
379 | | - * |
| 378 | + * actions. |
| 379 | + * |
380 | 380 | * The params listed below are the items posted in $params. |
381 | | - * @param $delete True if post is delete. Default is add. |
382 | | - * |
| 381 | + * @param $delete True if post is delete. Default is add. |
| 382 | + * |
383 | 383 | * @return The response from the respective helper function |
384 | | - */ |
| 384 | + */ |
385 | 385 | public function actionPostBullet( $params ) { |
386 | 386 | if ( isset( $params['delete'] ) && $params['delete'] == 'true' ) { |
387 | 387 | $verb = 'delete'; |
388 | 388 | } else { |
389 | 389 | $verb = 'add'; |
390 | 390 | } |
391 | | - |
| 391 | + |
392 | 392 | if ( !$this->hasPermission( $verb, 'bullet', $params ) ) { |
393 | 393 | return; |
394 | 394 | } |
395 | | - |
| 395 | + |
396 | 396 | if ( $verb == 'delete' ) { |
397 | 397 | $resp = $this->deleteBullet( $params ); |
398 | 398 | } else { |
399 | 399 | $resp = $this->addBullet( $params ); |
400 | 400 | } |
401 | | - |
| 401 | + |
402 | 402 | $this->getResult()->addValue( null, $this->getModuleName(), $resp ); |
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
406 | 406 | * Handles the response posts. Calls appropriate private helper functions |
407 | 407 | * for deletes and adds. Makes sure user has permission to perform requested |
408 | | - * actions. |
409 | | - * |
| 408 | + * actions. |
| 409 | + * |
410 | 410 | * The params listed below are the items posted in $params. |
411 | | - * @param $delete True if post is delete. Default is add. |
412 | | - * |
| 411 | + * @param $delete True if post is delete. Default is add. |
| 412 | + * |
413 | 413 | * @return The response from the respective helper function |
414 | | - */ |
| 414 | + */ |
415 | 415 | public function actionPostResponse( $params ) { |
416 | 416 | if ( isset( $params['delete'] ) && $params['delete'] == 'true' ) { |
417 | 417 | $verb = 'delete'; |
418 | 418 | } else { |
419 | 419 | $verb = 'add'; |
420 | 420 | } |
421 | | - |
| 421 | + |
422 | 422 | if ( !$this->hasPermission( $verb, 'response', $params ) ) { |
423 | 423 | return; |
424 | 424 | } |
425 | | - |
| 425 | + |
426 | 426 | if ( $verb == 'delete' ) { |
427 | 427 | $resp = $this->deleteResponse( $params ); |
428 | 428 | } else { |
429 | 429 | $resp = $this->addResponse( $params ); |
430 | 430 | } |
431 | | - |
| 431 | + |
432 | 432 | $this->getResult()->addValue( null, $this->getModuleName(), $resp ); |
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
436 | | - * Checks whether the current user has permission to execute a given action. |
437 | | - * Some of the characteristics examined include the users' level (admin, |
| 436 | + * Checks whether the current user has permission to execute a given action. |
| 437 | + * Some of the characteristics examined include the users' level (admin, |
438 | 438 | * registered, anon) and their ownership of the object being acted on. |
439 | | - * |
| 439 | + * |
440 | 440 | * @param $verb The action. |
441 | | - * @param $noun The object to be acted upon. |
442 | | - * @param $params The params posted by the requester. |
443 | | - * |
| 441 | + * @param $noun The object to be acted upon. |
| 442 | + * @param $params The params posted by the requester. |
| 443 | + * |
444 | 444 | * @return Returns true if the user has permission, false otherwise. |
445 | | - */ |
| 445 | + */ |
446 | 446 | private function hasPermission( $verb, $noun, $params ) { |
447 | 447 | |
448 | 448 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -464,42 +464,42 @@ |
465 | 465 | } else { |
466 | 466 | $bulletAuthor = $wgUser->getName(); |
467 | 467 | } |
468 | | - |
| 468 | + |
469 | 469 | if ( $wgUser->isAnon() ) { |
470 | 470 | $userLevel = -1; |
471 | | - } else if ( in_array( 'sysop', $wgUser->getGroups() ) ) { |
| 471 | + } elseif ( in_array( 'sysop', $wgUser->getGroups() ) ) { |
472 | 472 | $userLevel = 2; |
473 | 473 | } else { |
474 | 474 | $userLevel = 1; |
475 | 475 | } |
476 | | - |
| 476 | + |
477 | 477 | $userName = $wgUser->getName(); |
478 | 478 | if ( $noun == 'bullet' ) { |
479 | 479 | $denied = ( // only admins and bullet authors can delete bullets |
480 | | - $verb == 'delete' |
481 | | - && $bulletAuthor != $userName |
482 | | - && $userLevel < 2 |
| 480 | + $verb == 'delete' |
| 481 | + && $bulletAuthor != $userName |
| 482 | + && $userLevel < 2 |
483 | 483 | ) |
484 | 484 | || ( // commenters can't add bullets to their comment |
485 | | - $verb == 'add' |
486 | | - && $commentAuthor == $userName |
| 485 | + $verb == 'add' |
| 486 | + && $commentAuthor == $userName |
487 | 487 | ) ; |
488 | 488 | } elseif ( $noun == 'response' ) { |
489 | 489 | $denied = ( // only admins and response authors can delete responses |
490 | | - $verb == 'delete' |
491 | | - && $commentAuthor != $userName |
492 | | - && $userLevel < 2 |
493 | | - ) |
| 490 | + $verb == 'delete' |
| 491 | + && $commentAuthor != $userName |
| 492 | + && $userLevel < 2 |
| 493 | + ) |
494 | 494 | || ( // only comment authors can add responses |
495 | | - $verb == 'add' |
496 | | - && $commentAuthor != $userName |
| 495 | + $verb == 'add' |
| 496 | + && $commentAuthor != $userName |
497 | 497 | ) ; |
498 | 498 | } |
499 | 499 | return !$denied; |
500 | 500 | } |
501 | 501 | |
502 | 502 | /**** ApiBase functions *****/ |
503 | | - |
| 503 | + |
504 | 504 | public function getDescription() { |
505 | 505 | return 'Enables Reflect on posts in Liquid-Threaded discussions.'; |
506 | 506 | } |
Index: trunk/extensions/Oversight/HideRevision_body.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | $submitted = $wgRequest->wasPosted() && |
45 | 45 | $wgRequest->getVal( 'action' ) == 'submit' && |
46 | 46 | $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); |
47 | | - |
| 47 | + |
48 | 48 | if( $this->mPopulated && $submitted ) { |
49 | 49 | $this->submit(); |
50 | 50 | } elseif( $this->mPopulated ) { |
— | — | @@ -371,7 +371,7 @@ |
372 | 372 | $revision = $wgRequest->getIntOrNull( 'revision' ); |
373 | 373 | if( $wgRequest->getCheck( 'diff' ) && !is_null( $revision )) { |
374 | 374 | $this->showDiff( $revision); |
375 | | - } else if( is_null( $revision ) ) { |
| 375 | + } elseif( is_null( $revision ) ) { |
376 | 376 | $this->showList( $page, $user, $offender ); |
377 | 377 | } else { |
378 | 378 | $this->showRevision( $revision ); |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | |
382 | 382 | function showList( $page, $user, $offender ) { |
383 | 383 | global $wgOut, $wgScript; |
384 | | - |
| 384 | + |
385 | 385 | $title = Title::newFromURL( $page ); |
386 | 386 | $u = User::newFromName( $user ); |
387 | 387 | $page = $title ? $page : ''; // blank invalid titles |
— | — | @@ -419,7 +419,7 @@ |
420 | 420 | array( |
421 | 421 | 'ORDER BY' => 'hidden_on_timestamp DESC' ) ); |
422 | 422 | } |
423 | | - |
| 423 | + |
424 | 424 | public function getSelectFields() { |
425 | 425 | return array( 'hidden_page as page_id', |
426 | 426 | 'hidden_namespace as page_namespace', |
— | — | @@ -586,7 +586,7 @@ |
587 | 587 | $dbr->freeResult( $result ); |
588 | 588 | } |
589 | 589 | } |
590 | | - |
| 590 | + |
591 | 591 | /** |
592 | 592 | * Query to list out stable versions for a page |
593 | 593 | */ |
— | — | @@ -638,7 +638,7 @@ |
639 | 639 | function getIndexField() { |
640 | 640 | return 'hidden_on_timestamp'; |
641 | 641 | } |
642 | | - |
| 642 | + |
643 | 643 | function getStartBody() { |
644 | 644 | wfProfileIn( __METHOD__ ); |
645 | 645 | # Do a link batch query |
— | — | @@ -650,7 +650,7 @@ |
651 | 651 | wfProfileOut( __METHOD__ ); |
652 | 652 | return '<ul>'; |
653 | 653 | } |
654 | | - |
| 654 | + |
655 | 655 | function getEndBody() { |
656 | 656 | return '</ul>'; |
657 | 657 | } |
Index: trunk/extensions/PageObjectModel/POM/Template.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | # Split by pipe |
23 | 23 | $parts = explode( '|', $text ); |
24 | | - |
| 24 | + |
25 | 25 | # Check if this is a function call in the form #name: |
26 | 26 | $first_part = array_shift( $parts ); |
27 | 27 | if ( strpos( trim( $first_part ), "#" ) == 0 ) |
— | — | @@ -30,11 +30,11 @@ |
31 | 31 | $first_part = $splitted[0]; |
32 | 32 | array_unshift( $parts, $splitted[1] ); |
33 | 33 | } |
34 | | - |
| 34 | + |
35 | 35 | } |
36 | 36 | |
37 | 37 | $this->title_triple = new POMUtilTrimTriple( $first_part ); |
38 | | - |
| 38 | + |
39 | 39 | foreach ( $parts as $part ) |
40 | 40 | { |
41 | 41 | $this->parameters[] = POMTemplateParameter::parse( $part ); |
— | — | @@ -45,11 +45,11 @@ |
46 | 46 | { |
47 | 47 | return $this->title_triple->trimmed; |
48 | 48 | } |
49 | | - |
| 49 | + |
50 | 50 | public function getParametersCount() { |
51 | 51 | return count( $this->parameters ); |
52 | 52 | } |
53 | | - |
| 53 | + |
54 | 54 | public function getParameterName( $number ) { |
55 | 55 | if ( $number < 0 ) return ""; |
56 | 56 | if ( $number > count( $this->parameters ) - 1 ) return ""; |
— | — | @@ -59,25 +59,25 @@ |
60 | 60 | else |
61 | 61 | return ""; |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | public function removeParameterByNumber( $number ) { |
65 | 65 | if ( $number < 0 ) return; |
66 | 66 | if ( $number > count( $this->parameters ) - 1 ) return; |
67 | 67 | unset( $this->parameters[$number] ); |
68 | 68 | $this->parameters = array_values( $this->parameters ); |
69 | 69 | } |
70 | | - |
| 70 | + |
71 | 71 | public function getNumberByName( $name ) { |
72 | 72 | $trimmed_name = trim( $name ); |
73 | 73 | if ( strlen( $trimmed_name ) == 0 ) |
74 | 74 | throw new WrongParameterNameException( 'Can\'t get parameter with no name' ); |
75 | | - |
| 75 | + |
76 | 76 | for ( $i = 0; $i < count( $this->parameters ); $i++ ) { |
77 | 77 | $parameter = $this->parameters[$i]; |
78 | 78 | if ( $parameter->getName() == $trimmed_name ) return $i; |
79 | 79 | } |
80 | 80 | } |
81 | | - |
| 81 | + |
82 | 82 | public function getParameterByNumber( $number ) { |
83 | 83 | if ( $number < 0 ) return ""; |
84 | 84 | if ( $number > count( $this->parameters ) - 1 ) return ""; |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | return $parameter->getValue(); |
108 | 108 | } |
109 | 109 | } |
110 | | - else if ( is_a( $parameter, 'POMTemplateNumberedParameter' ) ) |
| 110 | + elseif ( is_a( $parameter, 'POMTemplateNumberedParameter' ) ) |
111 | 111 | { |
112 | 112 | if ( $number == $trimmed_name ) |
113 | 113 | { |
— | — | @@ -115,18 +115,18 @@ |
116 | 116 | $number++; |
117 | 117 | } |
118 | 118 | } |
119 | | - |
| 119 | + |
120 | 120 | return null; # none matched |
121 | 121 | } |
122 | | - |
| 122 | + |
123 | 123 | public function addParameter( $name, $value ) { |
124 | 124 | if ( strlen( trim( $name ) ) == 0 ) |
125 | 125 | throw new WrongParameterNameException( "Can't set parameter with no name" ); |
126 | | - |
| 126 | + |
127 | 127 | # add parameter to parameters array |
128 | 128 | $this->parameters[] = new POMTemplateNamedParameter( $name, $value ); |
129 | 129 | } |
130 | | - |
| 130 | + |
131 | 131 | public function setParameter( $name, $value, |
132 | 132 | $ignore_name_spacing = true, |
133 | 133 | $ignore_value_spacing = true, |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | public function asString() |
193 | 193 | { |
194 | 194 | if ( $this->hidden() ) return ""; |
195 | | - |
| 195 | + |
196 | 196 | $text = '{{' . $this->title_triple->toString(); |
197 | 197 | |
198 | 198 | for ( $i = 0; $i < count( $this->parameters ); $i++ ) |
Index: trunk/extensions/Plotters/Plotters.php |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | if ( preg_match( '/^==+ *([^*:\s|]+?)\s*==+\s*$/', $line, $m ) ) { |
120 | 120 | $section = $m[1]; |
121 | 121 | } |
122 | | - else if ( preg_match( '/^\*+ *([a-zA-Z](?:[-_:.\w\d ]*[a-zA-Z0-9])?)\s*((\|[^|]*)+)\s*$/', $line, $m ) ) { |
| 122 | + elseif ( preg_match( '/^\*+ *([a-zA-Z](?:[-_:.\w\d ]*[a-zA-Z0-9])?)\s*((\|[^|]*)+)\s*$/', $line, $m ) ) { |
123 | 123 | // NOTE: the plotter name is used as part of the name of a form field, |
124 | 124 | // and must follow the rules defined in http://www.w3.org/TR/html4/types.html#type-cdata |
125 | 125 | // Also, title-normalization applies. |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | $u = $t->getLocalURL( 'action=raw&ctype=' . $wgJsMimeType ); |
159 | 159 | $out->addScript( '<script type="' . $wgJsMimeType . '" src="' . htmlspecialchars( $u ) . '"></script>' . "\n" ); |
160 | 160 | } |
161 | | - else if ( preg_match( '/\.css/', $codePage ) ) { |
| 161 | + elseif ( preg_match( '/\.css/', $codePage ) ) { |
162 | 162 | $u = $t->getLocalURL( 'action=raw&ctype=text/css' ); |
163 | 163 | $out->addScript( '<style type="text/css">/*<![CDATA[*/ @import "' . $u . '"; /*]]>*/</style>' . "\n" ); |
164 | 164 | } |
— | — | @@ -228,7 +228,7 @@ |
229 | 229 | $plotkitname = "plotkit"; |
230 | 230 | if ( $parserOutput->mplotter["$genericname"] ) { |
231 | 231 | Plotters::setPlottersHeaders( $outputPage, 'generic' ); |
232 | | - } else if ( $parserOutput->mplotter["$plotkitname"] ) { |
| 232 | + } elseif ( $parserOutput->mplotter["$plotkitname"] ) { |
233 | 233 | Plotters::setPlottersHeaders( $outputPage, 'plotkit' ); |
234 | 234 | } |
235 | 235 | |
Index: trunk/extensions/Plotters/PlottersClass.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | if ( $this->argumentArray["script"] == "" ) { |
51 | 51 | $errors .= wfMsg( "plotters-missing-script" ) . "<br />"; |
52 | 52 | $errcnt++; |
53 | | - } else if ( strlen( $this->argumentArray["script"] ) > 255 ) { |
| 53 | + } elseif ( strlen( $this->argumentArray["script"] ) > 255 ) { |
54 | 54 | // Check to ensure scriptname is < 255 characters |
55 | 55 | $errors .= wfMsg( "plotters-excessively-long-scriptname" ) . "<br />"; |
56 | 56 | $errcnt++; |
Index: trunk/extensions/SemanticForms/specials/SF_UploadWindow.php |
— | — | @@ -347,7 +347,7 @@ |
348 | 348 | return; |
349 | 349 | } |
350 | 350 | $this->mainUploadWindowForm(); |
351 | | - } else if ( 'submit' == $this->mAction || $this->mUploadClicked ) { |
| 351 | + } elseif ( 'submit' == $this->mAction || $this->mUploadClicked ) { |
352 | 352 | $this->processUpload(); |
353 | 353 | } else { |
354 | 354 | $this->mainUploadWindowForm(); |
— | — | @@ -542,7 +542,7 @@ |
543 | 543 | if ( $this->mWatchthis ) { |
544 | 544 | global $wgUser; |
545 | 545 | $wgUser->addWatch( $this->mLocalFile->getTitle() ); |
546 | | - |
| 546 | + |
547 | 547 | } |
548 | 548 | // Success, redirect to description page |
549 | 549 | // $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() ); |
— | — | @@ -600,7 +600,7 @@ |
601 | 601 | // Check for uppercase extension. We allow these filenames but check if an image |
602 | 602 | // with lowercase extension exists already |
603 | 603 | $warning = ''; |
604 | | - |
| 604 | + |
605 | 605 | if ( strpos( $file->getName(), '.' ) == false ) { |
606 | 606 | $partname = $file->getName(); |
607 | 607 | $rawExtension = ''; |
— | — | @@ -710,7 +710,7 @@ |
711 | 711 | } |
712 | 712 | return $s; |
713 | 713 | } |
714 | | - |
| 714 | + |
715 | 715 | /** |
716 | 716 | * Render a preview of a given license for the AJAX preview on upload |
717 | 717 | * |
— | — | @@ -722,11 +722,11 @@ |
723 | 723 | $text = '{{' . $license . '}}'; |
724 | 724 | $title = Title::makeTitle( NS_IMAGE, 'Sample.jpg' ); |
725 | 725 | $options = ParserOptions::newFromUser( $wgUser ); |
726 | | - |
| 726 | + |
727 | 727 | // Expand subst: first, then live templates... |
728 | 728 | $text = $wgParser->preSaveTransform( $text, $title, $wgUser, $options ); |
729 | 729 | $output = $wgParser->parse( $text, $title, $options ); |
730 | | - |
| 730 | + |
731 | 731 | return $output->getText(); |
732 | 732 | } |
733 | 733 | |
— | — | @@ -894,10 +894,10 @@ |
895 | 895 | |
896 | 896 | $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; |
897 | 897 | $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; |
898 | | - |
| 898 | + |
899 | 899 | $adc = wfBoolToStr( $useAjaxDestCheck ); |
900 | 900 | $alp = wfBoolToStr( $useAjaxLicensePreview ); |
901 | | - |
| 901 | + |
902 | 902 | $wgOut->addScript( "<script type=\"text/javascript\"> |
903 | 903 | wgAjaxUploadDestCheck = {$adc}; |
904 | 904 | wgAjaxLicensePreview = {$alp}; |
— | — | @@ -910,7 +910,7 @@ |
911 | 911 | wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" ); |
912 | 912 | return false; |
913 | 913 | } |
914 | | - |
| 914 | + |
915 | 915 | if ( $this->mDesiredDestName && $wgUser->isAllowed( 'deletedhistory' ) ) { |
916 | 916 | $title = Title::makeTitleSafe( NS_IMAGE, $this->mDesiredDestName ); |
917 | 917 | if ( $title instanceof Title && ( $count = $title->isDeleted() ) > 0 ) { |
— | — | @@ -1028,14 +1028,14 @@ |
1029 | 1029 | <tr> |
1030 | 1030 | <td align='$align1'><label for='wpDestFile'>{$destfilename}</label></td> |
1031 | 1031 | <td align='$align2'> |
1032 | | - <input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' |
| 1032 | + <input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' |
1033 | 1033 | value="$encDestName" $destOnkeyup /> |
1034 | 1034 | </td> |
1035 | 1035 | </tr> |
1036 | 1036 | <tr> |
1037 | 1037 | <td align='$align1'><label for='wpUploadDescription'>{$summary}</label></td> |
1038 | 1038 | <td align='$align2'> |
1039 | | - <textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='4' |
| 1039 | + <textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='4' |
1040 | 1040 | cols='{$cols}'{$ew}>$encComment</textarea> |
1041 | 1041 | {$this->uploadFormTextAfterSummary} |
1042 | 1042 | </td> |
— | — | @@ -1073,12 +1073,12 @@ |
1074 | 1074 | |
1075 | 1075 | $wgOut->addHTML( " |
1076 | 1076 | <td align='$align1' nowrap='nowrap'><label for='wpUploadCopyStatus'>$filestatus:</label></td> |
1077 | | - <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' |
| 1077 | + <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' |
1078 | 1078 | value=\"$copystatus\" size='40' /></td> |
1079 | 1079 | </tr> |
1080 | 1080 | <tr> |
1081 | 1081 | <td align='$align1'><label for='wpUploadCopyStatus'>$filesource:</label></td> |
1082 | | - <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' |
| 1082 | + <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' |
1083 | 1083 | value=\"$uploadsource\" size='40' /></td> |
1084 | 1084 | </tr> |
1085 | 1085 | <tr> |
— | — | @@ -1245,7 +1245,7 @@ |
1246 | 1246 | } |
1247 | 1247 | } |
1248 | 1248 | |
1249 | | - /** |
| 1249 | + /** |
1250 | 1250 | * Heuristic for detecting files that *could* contain JavaScript instructions or |
1251 | 1251 | * things that may look like HTML to a browser and are thus |
1252 | 1252 | * potentially harmful. The present implementation will produce false positives in some situations. |
— | — | @@ -1343,7 +1343,7 @@ |
1344 | 1344 | return false; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | | - /** |
| 1347 | + /** |
1348 | 1348 | * Generic wrapper function for a virus scanner program. |
1349 | 1349 | * This relies on the $wgAntivirus and $wgAntivirusSetup variables. |
1350 | 1350 | * $wgAntivirusRequired may be used to deny upload if the scan fails. |
— | — | @@ -1416,11 +1416,11 @@ |
1417 | 1417 | } else { |
1418 | 1418 | return null; |
1419 | 1419 | } |
1420 | | - } else if ( $mappedCode === AV_SCAN_ABORTED ) { |
| 1420 | + } elseif ( $mappedCode === AV_SCAN_ABORTED ) { |
1421 | 1421 | # scan failed because filetype is unknown (probably imune) |
1422 | 1422 | wfDebug( __METHOD__ . ": unsupported file type $file (code $exitCode).\n" ); |
1423 | 1423 | return null; |
1424 | | - } else if ( $mappedCode === AV_NO_VIRUS ) { |
| 1424 | + } elseif ( $mappedCode === AV_NO_VIRUS ) { |
1425 | 1425 | # no virus found |
1426 | 1426 | wfDebug( __METHOD__ . ": file passed virus scan.\n" ); |
1427 | 1427 | return false; |
— | — | @@ -1502,7 +1502,7 @@ |
1503 | 1503 | return true; // non-conditional |
1504 | 1504 | if ( !$user->isAllowed( 'reupload-own' ) ) |
1505 | 1505 | return false; |
1506 | | - |
| 1506 | + |
1507 | 1507 | $dbr = wfGetDB( DB_SLAVE ); |
1508 | 1508 | $row = $dbr->selectRow( 'image', |
1509 | 1509 | /* SELECT */ 'img_user', |
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | |
124 | 124 | $sfgTabIndex++; |
125 | 125 | $checked = ""; |
126 | | - // figure out if the checkbox should be checked - |
| 126 | + // figure out if the checkbox should be checked - |
127 | 127 | // this code borrowed from /includes/EditPage.php |
128 | 128 | if ( $wgUser->getOption( 'watchdefault' ) ) { |
129 | 129 | # Watch all edits |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | $text = " <span class='editHelp'>$cancel</span>\n"; |
274 | 274 | return $text; |
275 | 275 | } |
276 | | - |
| 276 | + |
277 | 277 | static function runQueryButtonHTML( $is_disabled = false, $label = null, $attr = array() ) { |
278 | 278 | // is_disabled is currently ignored |
279 | 279 | global $sfgTabIndex; |
— | — | @@ -427,7 +427,7 @@ |
428 | 428 | var firstLoad = true; |
429 | 429 | var editorMsgOn = "' . wfMsg( 'textrichditor' ) . '"; |
430 | 430 | var editorMsgOff = "' . wfMsg( 'tog-riched_disable' ) . '"; |
431 | | -var editorLink = "' . ( ( $showFCKEditor & RTE_VISIBLE ) ? wfMsg( 'tog-riched_disable' ): wfMsg( 'textrichditor' ) ) . '"; |
| 431 | +var editorLink = "' . ( ( $showFCKEditor & RTE_VISIBLE ) ? wfMsg( 'tog-riched_disable' ): wfMsg( 'textrichditor' ) ) . '"; |
432 | 432 | var saveSetting = ' . ( $wgUser->getOption( 'riched_toggle_remember_state' ) ? 1 : 0 ) . '; |
433 | 433 | var RTE_VISIBLE = ' . RTE_VISIBLE . '; |
434 | 434 | var RTE_TOGGLE_LINK = ' . RTE_TOGGLE_LINK . '; |
— | — | @@ -451,7 +451,7 @@ |
452 | 452 | if ( substr( $wgFCKEditorDir, -1 ) != '/' ) { |
453 | 453 | $wgFCKEditorDir .= '/'; |
454 | 454 | } |
455 | | - |
| 455 | + |
456 | 456 | $javascript_text .= <<<END |
457 | 457 | var oFCKeditor = new FCKeditor( "free_text" ); |
458 | 458 | |
— | — | @@ -461,7 +461,7 @@ |
462 | 462 | oFCKeditor.Config["EditorAreaCSS"] = "$wgScriptPath/$wgFCKEditorExtDir/css/fckeditor.css" ; |
463 | 463 | oFCKeditor.Config["showreferences"] = '$showRef'; |
464 | 464 | oFCKeditor.Config["showsource"] = '$showSource'; |
465 | | -oFCKeditor.ToolbarSet = "$wgFCKEditorToolbarSet"; |
| 465 | +oFCKeditor.ToolbarSet = "$wgFCKEditorToolbarSet"; |
466 | 466 | oFCKeditor.ready = true; |
467 | 467 | |
468 | 468 | //IE hack to call func from popup |
— | — | @@ -481,7 +481,7 @@ |
482 | 482 | if (x.currentStyle) { |
483 | 483 | // IE |
484 | 484 | var y = x.currentStyle['lineheight']; |
485 | | - } else if (window.getComputedStyle) { |
| 485 | + } elseif (window.getComputedStyle) { |
486 | 486 | // FF, Opera |
487 | 487 | var y = document.defaultView.getComputedStyle(x,null).getPropertyValue('line-height'); |
488 | 488 | } |
— | — | @@ -502,7 +502,7 @@ |
503 | 503 | |
504 | 504 | function onLoadFCKeditor() |
505 | 505 | { |
506 | | - if (!(showFCKEditor & RTE_VISIBLE)) |
| 506 | + if (!(showFCKEditor & RTE_VISIBLE)) |
507 | 507 | showFCKEditor += RTE_VISIBLE; |
508 | 508 | firstLoad = false; |
509 | 509 | realTextarea = document.getElementById('free_text'); |
— | — | @@ -518,7 +518,7 @@ |
519 | 519 | } |
520 | 520 | oFCKeditor.Height = height; |
521 | 521 | oFCKeditor.ReplaceTextarea() ; |
522 | | - |
| 522 | + |
523 | 523 | FCKeditorInsertTags = function (tagOpen, tagClose, sampleText, oDoc) |
524 | 524 | { |
525 | 525 | var txtarea; |
— | — | @@ -527,7 +527,7 @@ |
528 | 528 | { |
529 | 529 | txtarea = oDoc.FCK.EditingArea.Textarea ; |
530 | 530 | } |
531 | | - else if (oDoc.editform) |
| 531 | + elseif (oDoc.editform) |
532 | 532 | { |
533 | 533 | // if we have FCK enabled, behave differently... |
534 | 534 | if ( showFCKEditor & RTE_VISIBLE ) |
— | — | @@ -539,16 +539,16 @@ |
540 | 540 | SRCdoc = window.frames[SRCiframe].oDoc ; |
541 | 541 | else |
542 | 542 | SRCdoc = SRCiframe.contentDocument ; |
543 | | - |
| 543 | + |
544 | 544 | var SRCarea = SRCdoc.getElementById ('xEditingArea').firstChild ; |
545 | | - |
| 545 | + |
546 | 546 | if (SRCarea) |
547 | 547 | txtarea = SRCarea ; |
548 | 548 | else |
549 | 549 | return false ; |
550 | | - |
551 | | - } |
552 | | - else |
| 550 | + |
| 551 | + } |
| 552 | + else |
553 | 553 | { |
554 | 554 | return false ; |
555 | 555 | } |
— | — | @@ -567,13 +567,13 @@ |
568 | 568 | |
569 | 569 | var selText, isSample = false ; |
570 | 570 | |
571 | | - if ( oDoc.selection && oDoc.selection.createRange ) |
| 571 | + if ( oDoc.selection && oDoc.selection.createRange ) |
572 | 572 | { // IE/Opera |
573 | 573 | |
574 | 574 | //save window scroll position |
575 | 575 | if ( oDoc.documentElement && oDoc.documentElement.scrollTop ) |
576 | 576 | var winScroll = oDoc.documentElement.scrollTop ; |
577 | | - else if ( oDoc.body ) |
| 577 | + elseif ( oDoc.body ) |
578 | 578 | var winScroll = oDoc.body.scrollTop ; |
579 | 579 | |
580 | 580 | //get current selection |
— | — | @@ -595,11 +595,11 @@ |
596 | 596 | //restore window scroll position |
597 | 597 | if ( oDoc.documentElement && oDoc.documentElement.scrollTop ) |
598 | 598 | oDoc.documentElement.scrollTop = winScroll ; |
599 | | - else if ( oDoc.body ) |
| 599 | + elseif ( oDoc.body ) |
600 | 600 | oDoc.body.scrollTop = winScroll ; |
601 | 601 | |
602 | | - } |
603 | | - else if ( txtarea.selectionStart || txtarea.selectionStart == '0' ) |
| 602 | + } |
| 603 | + elseif ( txtarea.selectionStart || txtarea.selectionStart == '0' ) |
604 | 604 | { // Mozilla |
605 | 605 | |
606 | 606 | //save textarea scroll position |
— | — | @@ -609,27 +609,27 @@ |
610 | 610 | var startPos = txtarea.selectionStart ; |
611 | 611 | var endPos = txtarea.selectionEnd ; |
612 | 612 | selText = txtarea.value.substring( startPos, endPos ) ; |
613 | | - |
| 613 | + |
614 | 614 | //insert tags |
615 | | - if (!selText) |
| 615 | + if (!selText) |
616 | 616 | { |
617 | 617 | selText = sampleText ; |
618 | 618 | isSample = true ; |
619 | | - } |
620 | | - else if (selText.charAt(selText.length - 1) == ' ') |
| 619 | + } |
| 620 | + elseif (selText.charAt(selText.length - 1) == ' ') |
621 | 621 | { //exclude ending space char |
622 | 622 | selText = selText.substring(0, selText.length - 1) ; |
623 | 623 | tagClose += ' ' ; |
624 | 624 | } |
625 | | - txtarea.value = txtarea.value.substring(0, startPos) + tagOpen + selText + tagClose + |
| 625 | + txtarea.value = txtarea.value.substring(0, startPos) + tagOpen + selText + tagClose + |
626 | 626 | txtarea.value.substring(endPos, txtarea.value.length) ; |
627 | 627 | //set new selection |
628 | | - if (isSample) |
| 628 | + if (isSample) |
629 | 629 | { |
630 | 630 | txtarea.selectionStart = startPos + tagOpen.length ; |
631 | 631 | txtarea.selectionEnd = startPos + tagOpen.length + selText.length ; |
632 | | - } |
633 | | - else |
| 632 | + } |
| 633 | + else |
634 | 634 | { |
635 | 635 | txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length ; |
636 | 636 | txtarea.selectionEnd = txtarea.selectionStart; |
— | — | @@ -645,19 +645,19 @@ |
646 | 646 | if (!selText) { |
647 | 647 | selText = sampleText; |
648 | 648 | isSample = true; |
649 | | - } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char |
| 649 | + } elseif (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char |
650 | 650 | selText = selText.substring(0, selText.length - 1); |
651 | 651 | tagClose += ' ' |
652 | | - } |
| 652 | + } |
653 | 653 | } |
654 | 654 | function initEditor() |
655 | | -{ |
| 655 | +{ |
656 | 656 | var toolbar = document.getElementById('free_text'); |
657 | 657 | //show popup or toogle link |
658 | 658 | if (showFCKEditor & (RTE_POPUP|RTE_TOGGLE_LINK)){ |
659 | 659 | var fckTools = document.createElement('div'); |
660 | 660 | fckTools.setAttribute('id', 'fckTools'); |
661 | | - |
| 661 | + |
662 | 662 | var SRCtextarea = document.getElementById( "free_text" ) ; |
663 | 663 | if (showFCKEditor & RTE_VISIBLE) SRCtextarea.style.display = "none"; |
664 | 664 | } |
— | — | @@ -717,7 +717,7 @@ |
718 | 718 | FCKeditor_OpenPopup('oFCKeditor',objId); |
719 | 719 | return true; |
720 | 720 | } |
721 | | - |
| 721 | + |
722 | 722 | var oToggleLink = document.getElementById('toggle_'+ objId ); |
723 | 723 | var oPopupLink = document.getElementById('popup_'+ objId ); |
724 | 724 | |
— | — | @@ -750,7 +750,7 @@ |
751 | 751 | }); |
752 | 752 | return true; |
753 | 753 | } |
754 | | - |
| 754 | + |
755 | 755 | if (!oFCKeditor.ready) return false; //sajax_do_call in action |
756 | 756 | if (!FCKeditorAPI) return false; //not loaded yet |
757 | 757 | var oEditorIns = FCKeditorAPI.GetInstance( objId ); |
Index: trunk/extensions/PrefSwitch/SpecialPrefSwitch.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | class SpecialPrefSwitch extends SpecialPage { |
11 | 11 | |
12 | 12 | /* Private Members */ |
13 | | - |
| 13 | + |
14 | 14 | private $origin = ''; |
15 | 15 | private $originTitle = null; |
16 | 16 | private $originQuery = ''; |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | /** |
31 | 31 | * Checks if a user's preferences are switched on |
32 | | - * |
| 32 | + * |
33 | 33 | * @param $user User object to check switched state for |
34 | 34 | * @return switched state |
35 | 35 | */ |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | * @param $user User object to set preferences for |
62 | 62 | */ |
63 | 63 | public static function switchOn( $user ) { |
64 | | - global $wgPrefSwitchPrefs; |
| 64 | + global $wgPrefSwitchPrefs; |
65 | 65 | foreach ( $wgPrefSwitchPrefs['on'] as $pref => $value ) { |
66 | 66 | $user->setOption( $pref, $value ); |
67 | 67 | } |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | private static function switchOffUser( $user ) { |
97 | 97 | global $wgPrefSwitchPrefs; |
98 | 98 | foreach ( $wgPrefSwitchPrefs['off'] as $pref => $value ) { |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | } |
103 | 103 | |
104 | 104 | /* Methods */ |
105 | | - |
| 105 | + |
106 | 106 | public function __construct() { |
107 | 107 | parent::__construct( 'PrefSwitch' ); |
108 | 108 | } |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | self::switchOff( $wgUser, $wgPrefSwitchGlobalOptOut && in_array( 'yes', $wgRequest->getArray( 'prefswitch-survey-global', array() ) ) ); |
150 | 150 | PrefSwitchSurvey::save( 'off', $wgPrefSwitchSurveys['feedback'] ); |
151 | 151 | $wgOut->addWikiMsg( 'prefswitch-success-off' ); |
152 | | - } else if ( !self::isSwitchedOn( $wgUser ) ) { |
| 152 | + } elseif ( !self::isSwitchedOn( $wgUser ) ) { |
153 | 153 | // User is already switched off then reloaded the page or tried to switch off again |
154 | 154 | $wgOut->addWikiMsg( 'prefswitch-success-off' ); |
155 | 155 | } else { |
— | — | @@ -214,9 +214,9 @@ |
215 | 215 | } |
216 | 216 | $wgOut->addHtml( '</div>' ); |
217 | 217 | } |
218 | | - |
| 218 | + |
219 | 219 | /* Private Methods */ |
220 | | - |
| 220 | + |
221 | 221 | private function render( $mode = null ) { |
222 | 222 | global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgPrefSwitchGlobalOptOut, $wgAllowUserCss, $wgAllowUserJs; |
223 | 223 | // Make sure links will retain the origin |
— | — | @@ -259,7 +259,7 @@ |
260 | 260 | $wgOut->addWikiMsgArray( |
261 | 261 | 'prefswitch-main-logged-changes', array( 'parse' ) |
262 | 262 | ); |
263 | | - |
| 263 | + |
264 | 264 | $oldSkin = 'monobook'; // The skin we are migrating from |
265 | 265 | |
266 | 266 | if ( $wgAllowUserJs ) { |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | if ( $cssPage->exists() ) { |
276 | 276 | $wgOut->addWikiMsg( 'prefswitch-csswarning', $wgUser->getName(), $oldSkin, array( 'parse' ) ); |
277 | 277 | } |
278 | | - } |
| 278 | + } |
279 | 279 | } |
280 | 280 | $wgOut->addWikiMsgArray( |
281 | 281 | 'prefswitch-main-feedback', wfMsgForContent( 'prefswitch-feedbackpage' ), array( 'parse' ) |
Index: trunk/extensions/SemanticNotifyMe/specials/SMWNotifyMe/SMW_NotAjaxAccess.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | $wgUser->saveSettings(); |
22 | 22 | return wfMsg( 'smw_nm_ajax_mailupdate' ); |
23 | 23 | } |
24 | | - else if ( $method == "addNotify" ) { |
| 24 | + elseif ( $method == "addNotify" ) { |
25 | 25 | if ( $smwgQEnabled ) { |
26 | 26 | $result = SMWNotifyProcessor::addNotify( str_replace( '&', '&', str_replace( ',', ',', $p_array[0] ) ), |
27 | 27 | str_replace( '&', '&', str_replace( ',', ',', $p_array[3] ) ), |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | return $result; |
31 | 31 | } |
32 | | - else if ( $method == "getQueryResult" ) { |
| 32 | + elseif ( $method == "getQueryResult" ) { |
33 | 33 | if ( $smwgQEnabled ) { |
34 | 34 | $params .= ' |
35 | 35 | | format=table |
— | — | @@ -76,31 +76,31 @@ |
77 | 77 | } |
78 | 78 | return $result; |
79 | 79 | } |
80 | | - else if ( $method == "updateStates" ) { |
| 80 | + elseif ( $method == "updateStates" ) { |
81 | 81 | if ( $smwgQEnabled ) { |
82 | 82 | $result = SMWNotifyProcessor::updateStates( $p_array ); |
83 | 83 | } |
84 | 84 | return $result; |
85 | 85 | } |
86 | | - else if ( $method == "updateReportAll" ) { |
| 86 | + elseif ( $method == "updateReportAll" ) { |
87 | 87 | if ( $smwgQEnabled ) { |
88 | 88 | $result = SMWNotifyProcessor::updateReportAll( $p_array ); |
89 | 89 | } |
90 | 90 | return $result; |
91 | 91 | } |
92 | | - else if ( $method == "updateShowAll" ) { |
| 92 | + elseif ( $method == "updateShowAll" ) { |
93 | 93 | if ( $smwgQEnabled ) { |
94 | 94 | $result = SMWNotifyProcessor::updateShowAll( $p_array ); |
95 | 95 | } |
96 | 96 | return $result; |
97 | 97 | } |
98 | | - else if ( $method == "updateDelegates" ) { |
| 98 | + elseif ( $method == "updateDelegates" ) { |
99 | 99 | if ( $smwgQEnabled ) { |
100 | 100 | $result = SMWNotifyProcessor::updateDelegates( explode( "|", $params ) ); |
101 | 101 | } |
102 | 102 | return $result; |
103 | 103 | } |
104 | | - else if ( $method == "delNotify" ) { |
| 104 | + elseif ( $method == "delNotify" ) { |
105 | 105 | if ( $smwgQEnabled ) { |
106 | 106 | $result = SMWNotifyProcessor::delNotify( $p_array ); |
107 | 107 | } |
Index: trunk/extensions/SemanticNotifyMe/includes/SMW_NotifyProcessor.smw15.php |
— | — | @@ -1313,7 +1313,7 @@ |
1314 | 1314 | $tmp_info[$key][del_vals][] = array( 'plain' => $v[value]->getWikiValue(), 'html' => $this->getFullLink( $v[value] ) ); |
1315 | 1315 | } |
1316 | 1316 | } |
1317 | | - } else if ( $i[type] == 2 ) { |
| 1317 | + } elseif ( $i[type] == 2 ) { |
1318 | 1318 | $mvalue = $info[$key]; |
1319 | 1319 | foreach ( $value as $v1 ) { |
1320 | 1320 | $found = false; |
— | — | @@ -1458,7 +1458,7 @@ |
1459 | 1459 | } |
1460 | 1460 | $this->m_notifyHtmlMsgs[$notify_id] .= $hint; |
1461 | 1461 | $this->m_newMonitor[] = array( 'notify_id' => $notify_id, 'page_id' => $page_id ); |
1462 | | - } else if ( ( !$match ) && $monitoring ) { |
| 1462 | + } elseif ( ( !$match ) && $monitoring ) { |
1463 | 1463 | $hint = wfMsg( 'smw_nm_hint_nomatch_html', $page_html_name, htmlspecialchars( $notify[name] ) ); |
1464 | 1464 | foreach ( $notify['user_ids'] as $uid ) { |
1465 | 1465 | $this->m_userMsgs[$uid] .= wfMsg( 'smw_nm_hint_nomatch', $page_name, $notify[name] ); |
— | — | @@ -1530,7 +1530,7 @@ |
1531 | 1531 | private function getFullLink( $val ) { |
1532 | 1532 | if ( $val instanceof SMWWikiPageValue ) { |
1533 | 1533 | return '<a href="' . $val->getTitle()->getFullUrl() . '">' . htmlspecialchars( $val->getTitle()->getText() ) . '</a>'; |
1534 | | - } else if ( $val instanceof SMWPropertyValue ) { |
| 1534 | + } elseif ( $val instanceof SMWPropertyValue ) { |
1535 | 1535 | $val = $val->getWikiPageValue(); |
1536 | 1536 | return '<a href="' . $val->getTitle()->getFullUrl() . '">' . htmlspecialchars( $val->getTitle()->getText() ) . '</a>'; |
1537 | 1537 | } else { |
— | — | @@ -1611,7 +1611,7 @@ |
1612 | 1612 | if ( isset( $this->m_userHtmlPropMsgs[$user_id] ) ) { |
1613 | 1613 | $html_msg .= wfMsg( 'smw_nm_hint_nmtable_html', $this->m_userHtmlPropMsgs[$user_id] ); |
1614 | 1614 | } |
1615 | | - |
| 1615 | + |
1616 | 1616 | global $wgNMReportModifier, $wgUser; |
1617 | 1617 | if ( $wgNMReportModifier ) { |
1618 | 1618 | $userText = $wgUser->getName(); |
Index: trunk/extensions/SemanticNotifyMe/includes/SMW_NotifyProcessor.php |
— | — | @@ -1313,7 +1313,7 @@ |
1314 | 1314 | $tmp_info[$key][del_vals][] = array( 'plain' => $v[value]->getWikiValue(), 'html' => $this->getFullLink( $v[value] ) ); |
1315 | 1315 | } |
1316 | 1316 | } |
1317 | | - } else if ( $i[type] == 2 ) { |
| 1317 | + } elseif ( $i[type] == 2 ) { |
1318 | 1318 | $mvalue = $info[$key]; |
1319 | 1319 | foreach ( $value as $v1 ) { |
1320 | 1320 | $found = false; |
— | — | @@ -1458,7 +1458,7 @@ |
1459 | 1459 | } |
1460 | 1460 | $this->m_notifyHtmlMsgs[$notify_id] .= $hint; |
1461 | 1461 | $this->m_newMonitor[] = array( 'notify_id' => $notify_id, 'page_id' => $page_id ); |
1462 | | - } else if ( ( !$match ) && $monitoring ) { |
| 1462 | + } elseif ( ( !$match ) && $monitoring ) { |
1463 | 1463 | $hint = wfMsg( 'smw_nm_hint_nomatch_html', $page_html_name, htmlspecialchars( $notify[name] ) ); |
1464 | 1464 | foreach ( $notify['user_ids'] as $uid ) { |
1465 | 1465 | $this->m_userMsgs[$uid] .= wfMsg( 'smw_nm_hint_nomatch', $page_name, $notify[name] ); |
— | — | @@ -1530,7 +1530,7 @@ |
1531 | 1531 | private function getFullLink( $val ) { |
1532 | 1532 | if ( $val instanceof SMWWikiPageValue ) { |
1533 | 1533 | return '<a href="' . $val->getTitle()->getFullUrl() . '">' . htmlspecialchars( $val->getTitle()->getText() ) . '</a>'; |
1534 | | - } else if ( $val instanceof SMWPropertyValue ) { |
| 1534 | + } elseif ( $val instanceof SMWPropertyValue ) { |
1535 | 1535 | $val = $val->getWikiPageValue(); |
1536 | 1536 | return '<a href="' . $val->getTitle()->getFullUrl() . '">' . htmlspecialchars( $val->getTitle()->getText() ) . '</a>'; |
1537 | 1537 | } else { |
— | — | @@ -1611,7 +1611,7 @@ |
1612 | 1612 | if ( isset( $this->m_userHtmlPropMsgs[$user_id] ) ) { |
1613 | 1613 | $html_msg .= wfMsg( 'smw_nm_hint_nmtable_html', $this->m_userHtmlPropMsgs[$user_id] ); |
1614 | 1614 | } |
1615 | | - |
| 1615 | + |
1616 | 1616 | global $wgNMReportModifier, $wgUser; |
1617 | 1617 | if ( $wgNMReportModifier ) { |
1618 | 1618 | $userText = $wgUser->getName(); |
Index: trunk/extensions/QPoll/Excel/Excel_Workbook.php |
— | — | @@ -1350,7 +1350,7 @@ |
1351 | 1351 | $align = 1; |
1352 | 1352 | } |
1353 | 1353 | # Split section without header => split on even boundary |
1354 | | - else if ($split_string && $space_remaining % 2 == 1) { |
| 1354 | + elseif ($split_string && $space_remaining % 2 == 1) { |
1355 | 1355 | $space_remaining--; |
1356 | 1356 | $align = 1; |
1357 | 1357 | } |
— | — | @@ -1524,7 +1524,7 @@ |
1525 | 1525 | $align = 1; |
1526 | 1526 | } |
1527 | 1527 | // Split section without header => split on even boundary |
1528 | | - else if ($split_string && $space_remaining % 2 == 1) { |
| 1528 | + elseif ($split_string && $space_remaining % 2 == 1) { |
1529 | 1529 | $space_remaining--; |
1530 | 1530 | $align = 1; |
1531 | 1531 | } |
Index: trunk/extensions/QPoll/Excel/Console_Getopt.php |
— | — | @@ -215,7 +215,7 @@ |
216 | 216 | if ($i + 1 < strlen($arg)) { |
217 | 217 | $opts[] = array($opt, substr($arg, $i + 1)); |
218 | 218 | break; |
219 | | - } else if (list(, $opt_arg) = each($args)) { |
| 219 | + } elseif (list(, $opt_arg) = each($args)) { |
220 | 220 | /* Else use the next argument. */; |
221 | 221 | if (Console_Getopt::_isShortOpt($opt_arg) |
222 | 222 | || Console_Getopt::_isLongOpt($opt_arg)) { |
— | — | @@ -324,7 +324,7 @@ |
325 | 325 | return PEAR::raiseError($msg); |
326 | 326 | } |
327 | 327 | } |
328 | | - } else if ($opt_arg) { |
| 328 | + } elseif ($opt_arg) { |
329 | 329 | $msg = "Console_Getopt: option --$opt doesn't allow an argument"; |
330 | 330 | return PEAR::raiseError($msg); |
331 | 331 | } |
Index: trunk/extensions/Player/Player.php |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | if ($ex->getCode() == '404') { |
91 | 91 | return $skin->makeBrokenLinkObj( Title::makeTitleSafe(NS_IMAGE, $name) ); |
92 | 92 | } |
93 | | - else if (@$player && $ex->getCode() == '403') { |
| 93 | + elseif (@$player && $ex->getCode() == '403') { |
94 | 94 | //TODO: show "normal" image thumbnail. requires parameter mangeling, though... |
95 | 95 | return $skin->makeKnownLinkObj( $player->title ); |
96 | 96 | } |
— | — | @@ -156,7 +156,7 @@ |
157 | 157 | $s.= urlencode($k); |
158 | 158 | |
159 | 159 | if ($v === false || $v === null) continue; |
160 | | - else if ($v !== true) $s.= '=' . urlencode($v); |
| 160 | + elseif ($v !== true) $s.= '=' . urlencode($v); |
161 | 161 | } |
162 | 162 | |
163 | 163 | return $s; |
Index: trunk/extensions/Player/PlayerClass.php |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | var $playerTitle; |
32 | 32 | |
33 | 33 | function __construct( $image, $options, $sizeDefault = 'imagesize' ) { |
34 | | - |
35 | 34 | |
| 35 | + |
36 | 36 | if ( is_null( $options ) ) $options = array(); |
37 | 37 | if ( is_string( $options ) ) $options = urldecodeMap( $options ); |
38 | 38 | |
— | — | @@ -48,8 +48,8 @@ |
49 | 49 | } |
50 | 50 | |
51 | 51 | static function newFromTitle( $title, $options, $sizeDefault = 'imagesize' ) { |
52 | | - |
53 | 52 | |
| 53 | + |
54 | 54 | $image = wfFindFile( $title ); |
55 | 55 | if ( !$image->exists() ) { |
56 | 56 | throw new PlayerException(wfMsg("player-not-found"), 404); |
— | — | @@ -59,8 +59,8 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | static function newFromName( $name, $options, $sizeDefault = 'imagesize' ) { |
63 | | - |
64 | 63 | |
| 64 | + |
65 | 65 | $title = Title::makeTitleSafe(NS_IMAGE, $name); |
66 | 66 | if (!$title) throw new PlayerException(wfMsg("player-invalid-title"), 400); |
67 | 67 | |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | if ( preg_match('!/(x-)?ogg$!', $this->mimetype) ) { |
90 | 90 | |
91 | 91 | if ( $this->mediatype == MEDIATYPE_AUDIO ) $this->mimetype = 'audio/ogg'; |
92 | | - else if ( $this->mediatype == MEDIATYPE_VIDEO ) $this->mimetype = 'video/ogg'; |
| 92 | + elseif ( $this->mediatype == MEDIATYPE_VIDEO ) $this->mimetype = 'video/ogg'; |
93 | 93 | else $this->mimetype = 'application/ogg'; |
94 | 94 | } |
95 | 95 | } |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | #print "[WH2: $width, $height]"; |
171 | 171 | |
172 | 172 | if (!$width) $width = ceil($height * $imgratio); |
173 | | - else if (!$height) $height = ceil($width / $imgratio); |
| 173 | + elseif (!$height) $height = ceil($width / $imgratio); |
174 | 174 | |
175 | 175 | #print "[WH3: $width, $height]"; |
176 | 176 | |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | if (!$mimetype) $mimetype = $image->getMimeType(); |
189 | 189 | |
190 | 190 | if (!is_array($wgPlayerVideoResolutionDetector)) $detector = $wgPlayerVideoResolutionDetector; |
191 | | - else if (isset($wgPlayerVideoResolutionDetector[$mimetype])) $detector = $wgPlayerVideoResolutionDetector[$mimetype]; |
| 191 | + elseif (isset($wgPlayerVideoResolutionDetector[$mimetype])) $detector = $wgPlayerVideoResolutionDetector[$mimetype]; |
192 | 192 | else $detector = $wgPlayerVideoResolutionDetector['*']; |
193 | 193 | |
194 | 194 | if (!$detector) return false; |
— | — | @@ -224,8 +224,8 @@ |
225 | 225 | */ |
226 | 226 | static function setHeaders( &$outputPage ) { |
227 | 227 | global $wgJsMimeType, $wgPlayerExtensionPath, $wgContLang; |
228 | | - |
229 | 228 | |
| 229 | + |
230 | 230 | # Register css file for Player |
231 | 231 | /*$outputPage->addLink( |
232 | 232 | array( |
— | — | @@ -446,9 +446,9 @@ |
447 | 447 | if (!$align) $align = 'none'; |
448 | 448 | |
449 | 449 | if ($align == 'left') $aligncls = 'tleft'; |
450 | | - else if ($align == 'right') $aligncls = 'tright'; |
451 | | - else if ($align == 'center') $aligncls = 'tnone'; |
452 | | - else if ($align == 'none') $aligncls = 'tnone'; |
| 450 | + elseif ($align == 'right') $aligncls = 'tright'; |
| 451 | + elseif ($align == 'center') $aligncls = 'tnone'; |
| 452 | + elseif ($align == 'none') $aligncls = 'tnone'; |
453 | 453 | else $aligncls = 'tnone'; //inlining complex boxes doesn't really work... |
454 | 454 | |
455 | 455 | $cls = 'playerbox thumb ' . $aligncls; |
Index: trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber_body.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | function __construct() { |
10 | 10 | parent::__construct( "PlayerStatsGrabber" ); |
11 | | - |
| 11 | + |
12 | 12 | } |
13 | 13 | |
14 | 14 | // used for page title |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | default: |
42 | 42 | if ( $wgRequest->getVal( 'action' ) == 'submit' ) { |
43 | 43 | $this->do_submit_survey(); |
44 | | - } else if ( $wgRequest->getVal( 'action' ) == 'survey' ) { |
| 44 | + } elseif ( $wgRequest->getVal( 'action' ) == 'survey' ) { |
45 | 45 | $this->do_survey_forum(); |
46 | 46 | } else { |
47 | 47 | $this->do_stats_page(); |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | // run the stats (if not internal oggPlay) |
79 | 79 | $this->runJS_Stats( $embed['url'] ); |
80 | 80 | $embed_code = $embed['html_code']; |
81 | | - } else if ( isset( $embed['wiki_code'] ) ) { |
| 81 | + } elseif ( isset( $embed['wiki_code'] ) ) { |
82 | 82 | $popts = new ParserOptions; |
83 | 83 | $parserOutput = $wgParser->parse( $embed['wiki_code'], $wgTitle, $popts ); |
84 | 84 | $embed_code = $parserOutput->getText(); |
Index: trunk/extensions/SemanticFormsInputs/SFI_Inputs.php |
— | — | @@ -667,7 +667,7 @@ |
668 | 668 | // find highlighted dates |
669 | 669 | if ( array_key_exists( "highlight dates", $other_args ) ) { |
670 | 670 | $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $other_args["highlight dates"] ) ) ) ; |
671 | | - } else if ( $sfigSettings->datePickerHighlightedDates ) { |
| 671 | + } elseif ( $sfigSettings->datePickerHighlightedDates ) { |
672 | 672 | $highlightedDates = self::sortAndMergeRanges ( self::createRangesArray( explode( ',' , $sfigSettings->datePickerHighlightedDates ) ) ) ; |
673 | 673 | } else { |
674 | 674 | $highlightedDates = null; |
Index: trunk/extensions/Renameuser/RenameUserJob.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | $conds[] = "$timestampColumn >= '$minTimestamp'"; |
48 | 48 | $conds[] = "$timestampColumn <= '$maxTimestamp'"; |
49 | 49 | # Otherwise, bound by key (B/C) |
50 | | - } else if ( isset( $uniqueKey ) ) { |
| 50 | + } elseif ( isset( $uniqueKey ) ) { |
51 | 51 | $conds[$uniqueKey] = $keyId; |
52 | 52 | } else { |
53 | 53 | wfDebug( 'RenameUserJob::run - invalid job row given' ); // this shouldn't happen |
Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php |
— | — | @@ -2,166 +2,166 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class for handling geographical SMW queries. |
6 | | - * |
| 6 | + * |
7 | 7 | * @since 0.7.3 |
8 | | - * |
| 8 | + * |
9 | 9 | * @ingroup SemanticMaps |
10 | 10 | * @file SM_QueryHandler.php |
11 | | - * |
| 11 | + * |
12 | 12 | * @author Jeroen De Dauw |
13 | 13 | */ |
14 | 14 | class SMQueryHandler { |
15 | | - |
| 15 | + |
16 | 16 | protected $queryResult; |
17 | 17 | protected $outputmode; |
18 | | - |
| 18 | + |
19 | 19 | protected $locations = false; |
20 | | - |
| 20 | + |
21 | 21 | /** |
22 | 22 | * The template to use for the text, or false if there is none. |
23 | | - * |
| 23 | + * |
24 | 24 | * @since 0.7.3 |
25 | | - * |
| 25 | + * |
26 | 26 | * @var false or string |
27 | 27 | */ |
28 | 28 | protected $template = false; |
29 | | - |
| 29 | + |
30 | 30 | /** |
31 | 31 | * The global icon. |
32 | | - * |
| 32 | + * |
33 | 33 | * @since 0.7.3 |
34 | | - * |
| 34 | + * |
35 | 35 | * @var string |
36 | | - */ |
| 36 | + */ |
37 | 37 | public $icon = ''; |
38 | | - |
| 38 | + |
39 | 39 | /** |
40 | 40 | * The global text. |
41 | | - * |
| 41 | + * |
42 | 42 | * @since 1.0 |
43 | | - * |
| 43 | + * |
44 | 44 | * @var string |
45 | | - */ |
| 45 | + */ |
46 | 46 | public $text = ''; |
47 | | - |
| 47 | + |
48 | 48 | /** |
49 | 49 | * The global title. |
50 | | - * |
| 50 | + * |
51 | 51 | * @since 1.0 |
52 | | - * |
| 52 | + * |
53 | 53 | * @var string |
54 | | - */ |
55 | | - public $title = ''; |
56 | | - |
| 54 | + */ |
| 55 | + public $title = ''; |
| 56 | + |
57 | 57 | /** |
58 | 58 | * Make a separate link to the title or not? |
59 | | - * |
| 59 | + * |
60 | 60 | * @since 0.7.3 |
61 | | - * |
| 61 | + * |
62 | 62 | * @var boolean |
63 | 63 | */ |
64 | 64 | public $titleLinkSeperate; |
65 | | - |
| 65 | + |
66 | 66 | /** |
67 | 67 | * Should link targets be made absolute (instead of relative)? |
68 | | - * |
| 68 | + * |
69 | 69 | * @since 1.0 |
70 | | - * |
| 70 | + * |
71 | 71 | * @var boolean |
72 | 72 | */ |
73 | 73 | protected $linkAbsolute; |
74 | | - |
| 74 | + |
75 | 75 | /** |
76 | | - * The text used for the link to the page (if it's created). $1 will be replaced by the page name. |
77 | | - * |
| 76 | + * The text used for the link to the page (if it's created). $1 will be replaced by the page name. |
| 77 | + * |
78 | 78 | * @since 1.0 |
79 | | - * |
| 79 | + * |
80 | 80 | * @var string |
81 | 81 | */ |
82 | | - protected $pageLinkText; |
83 | | - |
| 82 | + protected $pageLinkText; |
| 83 | + |
84 | 84 | /** |
85 | | - * A separator to use beteen the subject and properties in the text field. |
86 | | - * |
| 85 | + * A separator to use beteen the subject and properties in the text field. |
| 86 | + * |
87 | 87 | * @since 1.0 |
88 | | - * |
| 88 | + * |
89 | 89 | * @var string |
90 | 90 | */ |
91 | 91 | protected $subjectSeparator = '<hr />'; |
92 | | - |
| 92 | + |
93 | 93 | /** |
94 | 94 | * Make the subject in the text bold or not? |
95 | | - * |
| 95 | + * |
96 | 96 | * @since 1.0 |
97 | | - * |
| 97 | + * |
98 | 98 | * @var boolean |
99 | 99 | */ |
100 | 100 | protected $boldSubject = true; |
101 | | - |
| 101 | + |
102 | 102 | /** |
103 | 103 | * Show the subject in the text or not? |
104 | | - * |
| 104 | + * |
105 | 105 | * @since 1.0 |
106 | | - * |
| 106 | + * |
107 | 107 | * @var boolean |
108 | | - */ |
| 108 | + */ |
109 | 109 | protected $showSubject = true; |
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Constructor. |
113 | | - * |
| 113 | + * |
114 | 114 | * @since 0.7.3 |
115 | | - * |
| 115 | + * |
116 | 116 | * @param SMWQueryResult $queryResult |
117 | 117 | * @param integer $outputmode |
118 | 118 | */ |
119 | 119 | public function __construct( SMWQueryResult $queryResult, $outputmode, $linkAbsolute = false, $pageLinkText = '$1', $titleLinkSeperate = false ) { |
120 | 120 | $this->queryResult = $queryResult; |
121 | 121 | $this->outputmode = $outputmode; |
122 | | - |
| 122 | + |
123 | 123 | $this->linkAbsolute = $linkAbsolute; |
124 | 124 | $this->pageLinkText = $pageLinkText; |
125 | 125 | $this->titleLinkSeperate = $titleLinkSeperate; |
126 | 126 | } |
127 | | - |
| 127 | + |
128 | 128 | /** |
129 | 129 | * Sets the template. |
130 | | - * |
| 130 | + * |
131 | 131 | * @since 1.0 |
132 | | - * |
| 132 | + * |
133 | 133 | * @param string $template |
134 | 134 | */ |
135 | 135 | public function setTemplate( $template ) { |
136 | 136 | $this->template = $template == '' ? false : $template; |
137 | 137 | } |
138 | | - |
| 138 | + |
139 | 139 | /** |
140 | 140 | * Sets the global icon. |
141 | | - * |
| 141 | + * |
142 | 142 | * @since 1.0 |
143 | | - * |
| 143 | + * |
144 | 144 | * @param string $icon |
145 | 145 | */ |
146 | 146 | public function setIcon( $icon ) { |
147 | 147 | $this->icon = $icon; |
148 | 148 | } |
149 | | - |
| 149 | + |
150 | 150 | /** |
151 | 151 | * Sets the global title. |
152 | | - * |
| 152 | + * |
153 | 153 | * @since 1.0 |
154 | | - * |
| 154 | + * |
155 | 155 | * @param string $title |
156 | 156 | */ |
157 | 157 | public function setTitle( $title ) { |
158 | 158 | $this->title = $title; |
159 | 159 | } |
160 | | - |
| 160 | + |
161 | 161 | /** |
162 | 162 | * Sets the global text. |
163 | | - * |
| 163 | + * |
164 | 164 | * @since 1.0 |
165 | | - * |
| 165 | + * |
166 | 166 | * @param string $text |
167 | 167 | */ |
168 | 168 | public function setText( $text ) { |
— | — | @@ -170,31 +170,31 @@ |
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Sets the subject separator. |
174 | | - * |
| 174 | + * |
175 | 175 | * @since 1.0 |
176 | | - * |
| 176 | + * |
177 | 177 | * @param string $subjectSeparator |
178 | 178 | */ |
179 | 179 | public function setSubjectSeparator( $subjectSeparator ) { |
180 | 180 | $this->subjectSeparator = $subjectSeparator; |
181 | | - } |
182 | | - |
| 181 | + } |
| 182 | + |
183 | 183 | /** |
184 | 184 | * Sets if the subject should be made bold in the text. |
185 | | - * |
| 185 | + * |
186 | 186 | * @since 1.0 |
187 | | - * |
| 187 | + * |
188 | 188 | * @param string $boldSubject |
189 | 189 | */ |
190 | 190 | public function setBoldSubject( $boldSubject ) { |
191 | 191 | $this->boldSubject = $boldSubject; |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | /** |
195 | 195 | * Sets if the subject should shown in the text. |
196 | | - * |
| 196 | + * |
197 | 197 | * @since 1.0 |
198 | | - * |
| 198 | + * |
199 | 199 | * @param string $showSubject |
200 | 200 | */ |
201 | 201 | public function setShowSubject( $showSubject ) { |
— | — | @@ -211,105 +211,105 @@ |
212 | 212 | public function setPageLinkText( $text ) { |
213 | 213 | $this->pageLinkText = $text; |
214 | 214 | } |
215 | | - |
| 215 | + |
216 | 216 | /** |
217 | 217 | * Gets the query result as a list of locations. |
218 | | - * |
| 218 | + * |
219 | 219 | * @since 0.7.3 |
220 | | - * |
| 220 | + * |
221 | 221 | * @return array of MapsLocation |
222 | | - */ |
| 222 | + */ |
223 | 223 | public function getLocations() { |
224 | 224 | if ( $this->locations === false ) { |
225 | 225 | $this->locations = $this->findLocations(); |
226 | 226 | } |
227 | | - |
| 227 | + |
228 | 228 | return $this->locations; |
229 | 229 | } |
230 | | - |
| 230 | + |
231 | 231 | /** |
232 | 232 | * Gets the query result as a list of locations. |
233 | | - * |
| 233 | + * |
234 | 234 | * @since 0.7.3 |
235 | | - * |
| 235 | + * |
236 | 236 | * @return array of MapsLocation |
237 | | - */ |
| 237 | + */ |
238 | 238 | protected function findLocations() { |
239 | 239 | $locations = array(); |
240 | | - |
| 240 | + |
241 | 241 | while ( ( $row = $this->queryResult->getNext() ) !== false ) { |
242 | 242 | $locations = array_merge( $locations, $this->handleResultRow( $row ) ); |
243 | 243 | } |
244 | 244 | |
245 | 245 | return $locations; |
246 | 246 | } |
247 | | - |
| 247 | + |
248 | 248 | /** |
249 | 249 | * Returns the locations found in the provided result row. |
250 | | - * |
| 250 | + * |
251 | 251 | * @since 0.7.3 |
252 | | - * |
| 252 | + * |
253 | 253 | * @param array $row Array of SMWResultArray |
254 | | - * |
| 254 | + * |
255 | 255 | * @return array of MapsLocation |
256 | 256 | */ |
257 | 257 | protected function handleResultRow( array /* of SMWResultArray */ $row ) { |
258 | 258 | $locations = array(); |
259 | 259 | $properties = array(); |
260 | | - |
| 260 | + |
261 | 261 | $title = ''; |
262 | 262 | $text = ''; |
263 | | - |
| 263 | + |
264 | 264 | // Loop throught all fields of the record. |
265 | 265 | foreach ( $row as $i => $resultArray ) { |
266 | 266 | /* SMWPrintRequest */ $printRequest = $resultArray->getPrintRequest(); |
267 | | - |
| 267 | + |
268 | 268 | // Loop throught all the parts of the field value. |
269 | | - while ( ( /* SMWDataValue */ $dataValue = $resultArray->getNextDataValue() ) !== false ) { |
| 269 | + while ( ( /* SMWDataValue */ $dataValue = $resultArray->getNextDataValue() ) !== false ) { |
270 | 270 | if ( $dataValue->getTypeID() == '_wpg' && $i == 0 ) { |
271 | 271 | list( $title, $text ) = $this->handleResultSubject( $dataValue ); |
272 | 272 | } |
273 | | - else if ( $dataValue->getTypeID() != '_geo' && $i != 0 ) { |
| 273 | + elseif ( $dataValue->getTypeID() != '_geo' && $i != 0 ) { |
274 | 274 | $properties[] = $this->handleResultProperty( $dataValue, $printRequest ); |
275 | 275 | } |
276 | | - else if ( $printRequest->getMode() == SMWPrintRequest::PRINT_PROP && $printRequest->getTypeID() == '_geo' ) { |
| 276 | + elseif ( $printRequest->getMode() == SMWPrintRequest::PRINT_PROP && $printRequest->getTypeID() == '_geo' ) { |
277 | 277 | $dataItem = $dataValue->getDataItem(); |
278 | | - |
| 278 | + |
279 | 279 | $location = MapsLocation::newFromLatLon( $dataItem->getLatitude(), $dataItem->getLongitude() ); |
280 | | - |
| 280 | + |
281 | 281 | if ( $location->isValid() ) { |
282 | 282 | $locations[] = $location; |
283 | 283 | } |
284 | | - |
| 284 | + |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | | - |
| 288 | + |
289 | 289 | if ( count( $properties ) > 0 && $text != '' ) { |
290 | 290 | $text .= $this->subjectSeparator; |
291 | 291 | } |
292 | | - |
| 292 | + |
293 | 293 | $icon = $this->getLocationIcon( $row ); |
294 | | - |
| 294 | + |
295 | 295 | return $this->buildLocationsList( $locations, $title, $text, $icon, $properties ); |
296 | 296 | } |
297 | | - |
| 297 | + |
298 | 298 | /** |
299 | 299 | * Handles a SMWDataValue subject value. |
300 | 300 | * Gets the plain text title and creates the HTML text with headers and the like. |
301 | | - * |
| 301 | + * |
302 | 302 | * @since 1.0 |
303 | | - * |
| 303 | + * |
304 | 304 | * @param SMWDataValue $object |
305 | | - * |
| 305 | + * |
306 | 306 | * @return array with title and text |
307 | 307 | */ |
308 | 308 | protected function handleResultSubject( SMWDataValue $object ) { |
309 | 309 | global $wgUser; |
310 | | - |
| 310 | + |
311 | 311 | $title = $object->getLongText( $this->outputmode, null ); |
312 | 312 | $text = ''; |
313 | | - |
| 313 | + |
314 | 314 | if ( $this->showSubject ) { |
315 | 315 | if ( !$this->titleLinkSeperate && $this->linkAbsolute ) { |
316 | 316 | $text = Html::element( |
— | — | @@ -321,14 +321,14 @@ |
322 | 322 | else { |
323 | 323 | $text = $object->getLongText( $this->outputmode, $wgUser->getSkin() ); |
324 | 324 | } |
325 | | - |
| 325 | + |
326 | 326 | if ( $this->boldSubject ) { |
327 | 327 | $text = '<b>' . $text . '</b>'; |
328 | 328 | } |
329 | | - |
| 329 | + |
330 | 330 | if ( $this->titleLinkSeperate ) { |
331 | 331 | $txt = $object->getTitle()->getText(); |
332 | | - |
| 332 | + |
333 | 333 | if ( $this->pageLinkText != '' ) { |
334 | 334 | $txt = str_replace( '$1', $txt, $this->pageLinkText ); |
335 | 335 | } |
— | — | @@ -337,36 +337,36 @@ |
338 | 338 | array( 'href' => $object->getTitle()->getFullUrl() ), |
339 | 339 | $txt |
340 | 340 | ); |
341 | | - } |
| 341 | + } |
342 | 342 | } |
343 | 343 | |
344 | 344 | return array( $title, $text ); |
345 | 345 | } |
346 | | - |
| 346 | + |
347 | 347 | /** |
348 | 348 | * Handles a single property (SMWPrintRequest) to be displayed for a record (SMWDataValue). |
349 | | - * |
| 349 | + * |
350 | 350 | * @since 1.0 |
351 | | - * |
| 351 | + * |
352 | 352 | * @param SMWDataValue $object |
353 | 353 | * @param SMWPrintRequest $printRequest |
354 | | - * |
| 354 | + * |
355 | 355 | * @return string |
356 | 356 | */ |
357 | 357 | protected function handleResultProperty( SMWDataValue $object, SMWPrintRequest $printRequest ) { |
358 | 358 | global $wgUser; |
359 | | - |
| 359 | + |
360 | 360 | if ( $this->template ) { |
361 | 361 | if ( $object instanceof SMWWikiPageValue ) { |
362 | 362 | return $object->getTitle()->getPrefixedText(); |
363 | 363 | } else { |
364 | 364 | return $object->getLongText( SMW_OUTPUT_WIKI, NULL ); |
365 | 365 | } |
366 | | - } |
367 | | - |
| 366 | + } |
| 367 | + |
368 | 368 | if ( $this->linkAbsolute ) { |
369 | 369 | $t = Title::newFromText( $printRequest->getHTMLText( NULL ), SMW_NS_PROPERTY ); |
370 | | - |
| 370 | + |
371 | 371 | if ( $t->exists() ) { |
372 | 372 | $propertyName = $propertyName = Html::element( |
373 | 373 | 'a', |
— | — | @@ -376,20 +376,20 @@ |
377 | 377 | } |
378 | 378 | else { |
379 | 379 | $propertyName = $printRequest->getHTMLText( NULL ); |
380 | | - } |
| 380 | + } |
381 | 381 | } |
382 | 382 | else { |
383 | 383 | $propertyName = $printRequest->getHTMLText( $wgUser->getSkin() ); |
384 | 384 | } |
385 | | - |
| 385 | + |
386 | 386 | if ( $this->linkAbsolute ) { |
387 | 387 | $hasPage = $object->getTypeID() == '_wpg'; |
388 | | - |
| 388 | + |
389 | 389 | if ( $hasPage ) { |
390 | 390 | $t = Title::newFromText( $object->getLongText( $this->outputmode, NULL ), NS_MAIN ); |
391 | 391 | $hasPage = $t->exists(); |
392 | 392 | } |
393 | | - |
| 393 | + |
394 | 394 | if ( $hasPage ) { |
395 | 395 | $propertyValue = Html::element( |
396 | 396 | 'a', |
— | — | @@ -399,26 +399,26 @@ |
400 | 400 | } |
401 | 401 | else { |
402 | 402 | $propertyValue = $object->getLongText( $this->outputmode, NULL ); |
403 | | - } |
| 403 | + } |
404 | 404 | } |
405 | 405 | else { |
406 | 406 | $propertyValue = $object->getLongText( $this->outputmode, $wgUser->getSkin() ); |
407 | 407 | } |
408 | | - |
409 | | - return $propertyName . ( $propertyName == '' ? '' : ': ' ) . $propertyValue; |
| 408 | + |
| 409 | + return $propertyName . ( $propertyName == '' ? '' : ': ' ) . $propertyValue; |
410 | 410 | } |
411 | | - |
| 411 | + |
412 | 412 | /** |
413 | 413 | * Builds a set of locations with the provided title, text and icon. |
414 | | - * |
| 414 | + * |
415 | 415 | * @since 1.0 |
416 | | - * |
| 416 | + * |
417 | 417 | * @param array of MapsLocation $locations |
418 | 418 | * @param string $title |
419 | 419 | * @param string $text |
420 | 420 | * @param string $icon |
421 | 421 | * @param array $properties |
422 | | - * |
| 422 | + * |
423 | 423 | * @return array of MapsLocation |
424 | 424 | */ |
425 | 425 | protected function buildLocationsList( array $locations, $title, $text, $icon, array $properties ) { |
— | — | @@ -429,54 +429,54 @@ |
430 | 430 | else { |
431 | 431 | $text .= implode( '<br />', $properties ); |
432 | 432 | } |
433 | | - |
| 433 | + |
434 | 434 | foreach ( $locations as $location ) { |
435 | 435 | if ( $this->template ) { |
436 | 436 | $segments = array_merge( |
437 | 437 | array( $this->template, 'title=' . $title, 'latitude=' . $location->getLatitude(), 'longitude=' . $location->getLongitude() ), |
438 | 438 | $properties |
439 | 439 | ); |
440 | | - |
| 440 | + |
441 | 441 | $text .= $parser->parse( '{{' . implode( '|', $segments ) . '}}', $parser->getTitle(), new ParserOptions() )->getText(); |
442 | | - } |
443 | | - |
| 442 | + } |
| 443 | + |
444 | 444 | $location->setTitle( $title ); |
445 | 445 | $location->setText( $text ); |
446 | 446 | $location->setIcon( $icon ); |
447 | 447 | |
448 | | - $locations[] = $location; |
| 448 | + $locations[] = $location; |
449 | 449 | } |
450 | | - |
| 450 | + |
451 | 451 | return $locations; |
452 | 452 | } |
453 | | - |
| 453 | + |
454 | 454 | /** |
455 | 455 | * Get the icon for a row. |
456 | 456 | * |
457 | 457 | * @since 0.7.3 |
458 | 458 | * |
459 | 459 | * @param array $row |
460 | | - * |
| 460 | + * |
461 | 461 | * @return string |
462 | 462 | */ |
463 | 463 | protected function getLocationIcon( array $row ) { |
464 | 464 | $icon = ''; |
465 | 465 | $legend_labels = array(); |
466 | | - |
| 466 | + |
467 | 467 | // Look for display_options field, which can be set by Semantic Compound Queries |
468 | 468 | // the location of this field changed in SMW 1.5 |
469 | 469 | $display_location = method_exists( $row[0], 'getResultSubject' ) ? $row[0]->getResultSubject() : $row[0]; |
470 | | - |
| 470 | + |
471 | 471 | if ( property_exists( $display_location, 'display_options' ) && is_array( $display_location->display_options ) ) { |
472 | 472 | $display_options = $display_location->display_options; |
473 | 473 | if ( array_key_exists( 'icon', $display_options ) ) { |
474 | 474 | $icon = $display_options['icon']; |
475 | 475 | |
476 | | - // This is somewhat of a hack - if a legend label has been set, we're getting it for every point, instead of just once per icon |
| 476 | + // This is somewhat of a hack - if a legend label has been set, we're getting it for every point, instead of just once per icon |
477 | 477 | if ( array_key_exists( 'legend label', $display_options ) ) { |
478 | | - |
| 478 | + |
479 | 479 | $legend_label = $display_options['legend label']; |
480 | | - |
| 480 | + |
481 | 481 | if ( ! array_key_exists( $icon, $legend_labels ) ) { |
482 | 482 | $legend_labels[$icon] = $legend_label; |
483 | 483 | } |
— | — | @@ -488,6 +488,6 @@ |
489 | 489 | } |
490 | 490 | |
491 | 491 | return $icon; |
492 | | - } |
493 | | - |
| 492 | + } |
| 493 | + |
494 | 494 | } |
Index: trunk/extensions/SemanticGraph/includes/SemanticGraphHelperFunctions.php |
— | — | @@ -1,29 +1,29 @@ |
2 | 2 | <?php |
3 | 3 | function efBigPic($fileurl, $imgwidth, $imgheight, $boxwidth = null, $boxheight = null, $boxresize = 'none', $zoom = 'tofit') { |
4 | | - |
| 4 | + |
5 | 5 | global $wgBigPicCounter; |
6 | 6 | @$wgBigPicCounter += 1; |
7 | 7 | /* |
8 | 8 | $fileurl, the URL to the image |
9 | | - $imgwidth, |
10 | | - $imgheight, |
| 9 | + $imgwidth, |
| 10 | + $imgheight, |
11 | 11 | $boxwidth = null, if null the value is calculated to maintain aspect ratio of image using boxheight. |
12 | | - $boxheight = null, if null the value is calculated to maintain aspect ratio of image using boxwidth. |
13 | | - If both boxwidth and boxheight null will default to size of image |
| 12 | + $boxheight = null, if null the value is calculated to maintain aspect ratio of image using boxwidth. |
| 13 | + If both boxwidth and boxheight null will default to size of image |
14 | 14 | $boxresize = 'none'|'toimage', only does anything if both boxwidth and boxheight are specified |
15 | 15 | $zoom = 'tofit'|'topage'|numeric value>0, will fit image into box either to fit all (topage) or by width (tofit) or any zoom value |
16 | | - |
| 16 | + |
17 | 17 | more than one of these functions in a page generates cross talk between script functions and unpredictable effects. |
18 | 18 | */ |
19 | | - |
| 19 | + |
20 | 20 | $x=$imgwidth; |
21 | 21 | $y=$imgheight; |
22 | | - |
| 22 | + |
23 | 23 | list($imgwidth, $imgheight, $boxwidth, $boxheight, $offsetx, $offsety) = boxsizing($imgwidth, $imgheight, $boxwidth, $boxheight, $boxresize, $zoom); |
24 | | - |
| 24 | + |
25 | 25 | $c = $wgBigPicCounter; |
26 | 26 | //clip:rect(0px '.$boxheight.'px '.$boxwidth.'px 0px); |
27 | | - |
| 27 | + |
28 | 28 | $html = '<div id=maptable style="position:relative;overflow:hidden;height:'.$boxheight.'px;' |
29 | 29 | .'width:'.$boxwidth.'px;border:2px inset #aeaeae;">' |
30 | 30 | .'<div id=zoom style="position:absolute;top:10px;left:10px;color:yellow;background-color:transparent; z-index:10;">' |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | .'<a style="border:1px solid black;background-color:white; text-decoration:none; padding:2px;line-height:1.8em;color:black;" onclick="zoomOut()">Zoom out</a></div>' |
33 | 33 | .'<div id=mover style="position:relative;height:'.$imgheight.'px;width:'.$imgwidth.'px;top:'.$offsety.'px;left:'.$offsetx.'px;" onmousedown="startDrag(event)">' |
34 | 34 | .'<img style="height:100%;width:100%" ondragstart="return false" onmousedown="return false" src="'.$fileurl.'" id=earthMap title="" /></div></div>'; |
35 | | - |
| 35 | + |
36 | 36 | $js = "<script type=\"text/javascript\">/*@cc_on @*/ |
37 | 37 | mapWidth=$imgwidth; |
38 | 38 | mapHeight=$imgheight; |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | } |
68 | 68 | var offsetX,offsetY,draggingThing; |
69 | 69 | function startDrag(e) { |
70 | | - draggingThing=document.getElementById('mover'); |
| 70 | + draggingThing=document.getElementById('mover'); |
71 | 71 | offsetX=e.clientX-draggingThing.offsetLeft; |
72 | 72 | offsetY=e.clientY-draggingThing.offsetTop; |
73 | 73 | document.body.onmousemove=moveDrag; |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | document.onselectstart=null; |
93 | 93 | } |
94 | 94 | </script>"; |
95 | | - |
| 95 | + |
96 | 96 | return $js."\n".$html; |
97 | 97 | } |
98 | 98 | |
— | — | @@ -99,15 +99,15 @@ |
100 | 100 | if ($boxwidth == null && $boxheight == null) { |
101 | 101 | $boxwidth = $imgwidth; |
102 | 102 | $boxheight = $imgheight; |
103 | | - } else if ($boxwidth == null && $boxheight != null) { |
| 103 | + } elseif ($boxwidth == null && $boxheight != null) { |
104 | 104 | $boxwidth = $imgwidth * $boxheight/$imgheight; |
105 | 105 | $imgwidth = $boxwidth; |
106 | 106 | $imgheight = $boxheight; |
107 | | - } else if ($boxwidth != null && $boxheight == null) { |
| 107 | + } elseif ($boxwidth != null && $boxheight == null) { |
108 | 108 | $boxheight = $imgheight * $boxwidth/$imgwidth; |
109 | 109 | $imgwidth = $boxwidth; |
110 | 110 | $imgheight = $boxheight; |
111 | | - } else if ($boxresize == "toimage") { |
| 111 | + } elseif ($boxresize == "toimage") { |
112 | 112 | if (($imgwidth/$imgheight) < ($boxwidth/$boxheight)) { |
113 | 113 | // img is more portrait oriented than box |
114 | 114 | // shrink box width to correct aspect ratio |
— | — | @@ -125,13 +125,13 @@ |
126 | 126 | //shrink image to fit smallest dimension |
127 | 127 | $imgwidth = min($scale) * $imgwidth; |
128 | 128 | $imgheight = min($scale) * $imgheight; |
129 | | - } else if ($zoom == 'tofit') { |
| 129 | + } elseif ($zoom == 'tofit') { |
130 | 130 | //shrink image to both dimensions |
131 | 131 | $imgwidth = max($scale) * $imgwidth; |
132 | 132 | $imgheight = max($scale) * $imgheight; |
133 | 133 | } |
134 | 134 | } |
135 | | - |
| 135 | + |
136 | 136 | /* |
137 | 137 | if ((int) $zoom > 0) { |
138 | 138 | //override calculated values if a percentage zoom has been specified |
— | — | @@ -142,39 +142,39 @@ |
143 | 143 | //centre image in box |
144 | 144 | $offsetx = ($boxwidth - $imgwidth)/2; |
145 | 145 | $offsety = ($boxheight - $imgheight)/2; |
146 | | - |
| 146 | + |
147 | 147 | $offsetx = floor($offsetx); |
148 | 148 | $offsety = floor($offsety); |
149 | 149 | $boxwidth = floor($boxwidth); |
150 | 150 | $imgwidth = floor($imgwidth); |
151 | 151 | $boxheight = floor($boxheight); |
152 | 152 | $imgheight = floor($imgheight); |
153 | | - |
| 153 | + |
154 | 154 | return array($imgwidth, $imgheight, $boxwidth, $boxheight, $offsetx, $offsety); |
155 | 155 | } |
156 | 156 | |
157 | 157 | function efBigSvg($svgurl, $boxwidth = null, $boxheight = null, $boxresize = 'none', $zoom = 'tofit') { |
158 | | - |
| 158 | + |
159 | 159 | /* |
160 | 160 | $fileurl, the URL to the image |
161 | | - $imgwidth, |
162 | | - $imgheight, |
| 161 | + $imgwidth, |
| 162 | + $imgheight, |
163 | 163 | $boxwidth = null, if null the value is calculated to maintain aspect ratio of image using boxheight. |
164 | | - $boxheight = null, if null the value is calculated to maintain aspect ratio of image using boxwidth. |
165 | | - If both boxwidth and boxheight both null will default to size of image. |
| 164 | + $boxheight = null, if null the value is calculated to maintain aspect ratio of image using boxwidth. |
| 165 | + If both boxwidth and boxheight both null will default to size of image. |
166 | 166 | $boxresize = 'none'|'toimage', only does anything if both boxwidth and boxheight are specified when it will resize one dimension |
167 | 167 | to maintain the image aspect ratio. |
168 | 168 | $zoom = 'tofit'|'topage'|numeric value>0, will fit image into box either to fit all (topage) or by width (tofit) or any zoom value |
169 | | - |
| 169 | + |
170 | 170 | more than one of these functions in a page generates cross talk between script functions and unpredictable effects. |
171 | 171 | */ |
172 | | - |
| 172 | + |
173 | 173 | //echo $svgurl; exit(0); |
174 | | - |
| 174 | + |
175 | 175 | $svg = new DOMDocument(); |
176 | 176 | @$str = file_get_contents($svgurl); |
177 | 177 | $svg->loadXML($str); |
178 | | - |
| 178 | + |
179 | 179 | $svgnode = $svg->getElementsByTagName('svg')->item(0); |
180 | 180 | //get width and height from svg document - this is expressed in pt and needs to be changed to user units to align to browsers view of scale. |
181 | 181 | $imgwidth = (int) $svgnode->getAttribute('width'); |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | $svgnode->setAttribute('width',$boxwidth); |
188 | 188 | $svgnode->setAttribute('height',$boxheight); |
189 | 189 | $scale = $imgwidth/$x; |
190 | | - |
| 190 | + |
191 | 191 | $js = ' var fx='.(-$x/2).'; |
192 | 192 | var fy='.(-$y/2).'; |
193 | 193 | var scale='.$scale.'; |
— | — | @@ -248,15 +248,15 @@ |
249 | 249 | function translation(x, y, s) { |
250 | 250 | return \'translate('.($boxwidth/2).','.($boxheight/2).') scale(\'+s+\') translate(\'+x+\',\'+y+\')\'; |
251 | 251 | }'; |
252 | | - |
| 252 | + |
253 | 253 | $js=preg_replace('|^\s*\r?\n|m','',$js); //strip whitespace to prevent some spurious wiki parsing |
254 | 254 | $js=preg_replace('|^\s*|m','',$js); |
255 | | - $js=preg_replace('|\s*\r?\n|m','',$js); |
256 | | - |
| 255 | + $js=preg_replace('|\s*\r?\n|m','',$js); |
| 256 | + |
257 | 257 | $scriptnode = $svg->createElement('script', $js); |
258 | 258 | $scriptnode->setAttribute('type','text/ecmascript'); |
259 | | - |
260 | 259 | |
| 260 | + |
261 | 261 | //clear initial transforms applied by graphviz we will have to reimplement. should probably check here that current assumptions around way graphviz behaves are true. |
262 | 262 | $svgnode->removeAttribute('viewBox'); |
263 | 263 | $svgnode->setAttribute('overflow','hidden'); // this has effect of removing scroll bars in viewing window which is good because we need to be incontrol of position |
— | — | @@ -267,30 +267,30 @@ |
268 | 268 | $tnode->setAttribute('style',$pt); |
269 | 269 | } |
270 | 270 | //export as svgtxt |
271 | | - |
| 271 | + |
272 | 272 | //fix javascript to interact with svg DOM mover element. |
273 | | - |
274 | | - |
275 | | - |
| 273 | + |
| 274 | + |
| 275 | + |
276 | 276 | $transform = 'translate('.($boxwidth/2).','.($boxheight/2).') '; |
277 | 277 | //the original scale factor. This is what will be changed with zooming |
278 | 278 | $transform .= 'scale('.$scale.') '; |
279 | 279 | //initial focus point is centre of original image. This is what is going to be changed with panning |
280 | 280 | $transform .= 'translate('.(-$x/2).','.(-$y/2).') '; |
281 | 281 | // the processing order of these feels wrong to me - i wonder if this is a bug in firefox. |
282 | | - |
| 282 | + |
283 | 283 | $graph0 = $svg->getElementsByTagName('g')->item(0); |
284 | 284 | $graph0->setAttribute('transform',$transform); |
285 | 285 | $graph0->setAttribute('id','mover'); |
286 | 286 | $graph0->parentNode->insertBefore($scriptnode, $graph0); |
287 | | - |
| 287 | + |
288 | 288 | foreach($svg->getElementsByTagName('a') as $link) { |
289 | 289 | $link->setAttributeNS('http://www.w3.org/1999/xlink','xlink:show','new'); |
290 | 290 | } // this needs to be done to get round usability iframe behaviour. |
291 | | - |
| 291 | + |
292 | 292 | $background = $svg->getElementsByTagName('polygon')->item(0); |
293 | 293 | $background->setAttribute('onmousedown','startDrag(evt)'); |
294 | | - |
| 294 | + |
295 | 295 | $zoomcontrols = '<g id="zoomcontrols" class="graph">' |
296 | 296 | .'<rect id="background" style="fill:none;stroke:black;" x="0" y="0" width="'.$boxwidth.'" height="'.$boxheight.'"/>' |
297 | 297 | .'<g id="zoomin" class="node" onclick="zoomIn()"><rect style="fill:#f0f0f0;stroke:black;" x="10" y="10" width="20" height="15"/><text text-anchor="middle" x="20" y="20" style="font-family:Arial;font-size:7pt;fill:black;">in</text></g>' |
— | — | @@ -301,13 +301,13 @@ |
302 | 302 | .'<g id="down" class="node" onclick="panDown()"><polygon style="fill:#f0f0f0;stroke:black;" points="25,70 45,70 35,80"/></g>' |
303 | 303 | .'<g id="centre" class="node" onclick="centre()"><ellipse style="fill:#f0f0f0;stroke:black;" cx="35" cy="55" rx="10" ry="10"/></g>' |
304 | 304 | .'</g>'; |
305 | | - |
| 305 | + |
306 | 306 | $svgtxt = $svg->saveXML($svg->documentElement); |
307 | 307 | $svgtxt = str_replace("</svg>", $zoomcontrols."</svg>", $svgtxt); //apologies to DOM purists out there. |
308 | 308 | |
309 | 309 | |
310 | 310 | |
311 | | - |
| 311 | + |
312 | 312 | //return $js; |
313 | 313 | return $svgtxt; |
314 | 314 | } |
Index: trunk/extensions/SemanticGraph/includes/SemanticGraphBuilders.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | var $gq; |
6 | 6 | var $nodes; |
7 | 7 | var $links; |
8 | | - |
| 8 | + |
9 | 9 | //make a temp table |
10 | 10 | |
11 | 11 | function __construct($args) { |
— | — | @@ -12,10 +12,10 @@ |
13 | 13 | $this->gq = new GraphQuery($args); |
14 | 14 | $this->args = $args; |
15 | 15 | $SMWengine = new SMWSQLStore2; |
16 | | - $this->dbr = wfGetDB( DB_SLAVE ); |
| 16 | + $this->dbr = wfGetDB( DB_SLAVE ); |
17 | 17 | //need to hold onto this until all queries done as it controls the existance |
18 | 18 | //of the temporary tables |
19 | | - |
| 19 | + |
20 | 20 | $resources=array(); //can be subjects and / or objects |
21 | 21 | foreach ((array) $this->args['resource'] as $t) { |
22 | 22 | $x = Title::newFromDBkey($t); |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | $temptable["page_title"] = $t; |
27 | 27 | $temptable["smw_id"] = $SMWengine->getSMWPageID($x->getDBkey(),$x->getNamespace(),$x->getInterwiki()); |
28 | 28 | } |
29 | | - |
| 29 | + |
30 | 30 | $p = $this->args['property']; |
31 | 31 | if (!is_array($p)) $p = array($p); |
32 | 32 | if (!is_array($titlearr)) $titlearr = array($titlearr); |
— | — | @@ -33,15 +33,15 @@ |
34 | 34 | foreach ($p as $prop) { |
35 | 35 | if ($prop == Title::makeTitle(SMW_NS_PROPERTY,$wgSemanticGraphSettings->dummyCategoryLinkProperty)->getPrefixedDBkey()) { |
36 | 36 | $this->getPagesFromCategory($titlearr); |
37 | | - } else if ($prop == Title::makeTitle(SMW_NS_PROPERTY,$wgSemanticGraphSettings->dummyWikiLinkProperty)->getPrefixedDBkey()) { |
| 37 | + } elseif ($prop == Title::makeTitle(SMW_NS_PROPERTY,$wgSemanticGraphSettings->dummyWikiLinkProperty)->getPrefixedDBkey()) { |
38 | 38 | $this->getPagesFromWikilinks($titlearr); |
39 | 39 | } else { |
40 | 40 | $this->getPagesFromSemantics( $titlearr , $prop); |
41 | 41 | } |
42 | 42 | } |
43 | | - |
| 43 | + |
44 | 44 | //FIXME FIXME |
45 | | - |
| 45 | + |
46 | 46 | $properties=array(); |
47 | 47 | foreach ((array) $this->args['property'] as $t) { |
48 | 48 | $x = Title::newFromDBkey($t); // these must exist |
— | — | @@ -54,22 +54,22 @@ |
55 | 55 | $temptable["subj2obj"] = true; |
56 | 56 | $temptable["obj2subj"] = false; |
57 | 57 | } |
58 | | - |
59 | | - //build temp tables based on this and a rdf triple store for the result based on first pass query of |
| 58 | + |
| 59 | + //build temp tables based on this and a rdf triple store for the result based on first pass query of |
60 | 60 | //smw_rels2 for semantic queries |
61 | 61 | //what about normal wiki and category queries? |
62 | | - |
| 62 | + |
63 | 63 | } |
64 | 64 | |
65 | 65 | /*function buildFromWiki() { |
66 | 66 | //deprecate this in preference of constructor |
67 | | - |
| 67 | + |
68 | 68 | $this->nodes = $this->args['resource']; // this can be singelton or array |
69 | 69 | if (!is_array($this->nodes)) $this->nodes = array($this->nodes); |
70 | 70 | $n = $this->nodes; |
71 | 71 | //identify smw_ids from page titles. |
72 | 72 | //identify normal page_ids from page titles. |
73 | | - |
| 73 | + |
74 | 74 | $this->links = array(); |
75 | 75 | for ($i=0; $i < $this->args['depth']; $i++) { |
76 | 76 | $this->gq->doQuery($n); |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | } |
133 | 133 | |
134 | 134 | //private functions |
135 | | - |
| 135 | + |
136 | 136 | /*DO ME IN SQL |
137 | 137 | function arrayUnique($myArray) { |
138 | 138 | if(!is_array($myArray)) |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | } |
252 | 252 | } |
253 | 253 | } |
254 | | - |
| 254 | + |
255 | 255 | function foldtype($level,$count) { |
256 | 256 | global $wgSemanticGraphSettings; |
257 | 257 | switch ($this->args['fold']) { |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | } |
274 | 274 | return "false"; |
275 | 275 | } |
276 | | - |
| 276 | + |
277 | 277 | function backlink($newnode, $t) { |
278 | 278 | $element = $this->map->createElement('arrowlink'); |
279 | 279 | $element->setAttribute('DESTINATION',$t); //this is potentially not unique behaviour may be unpredictable |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | var $ng; |
295 | 295 | var $map; |
296 | 296 | var $output; |
297 | | - |
| 297 | + |
298 | 298 | function __construct($args) { |
299 | 299 | global $wgSemanticGraphSettings; |
300 | 300 | $this->args = $args; |
— | — | @@ -308,7 +308,7 @@ |
309 | 309 | $title = $this->args['resource']; // this should already be validated to be a singleton |
310 | 310 | $this->output=$this->recursiveBuildTable($title, $level); |
311 | 311 | } |
312 | | - |
| 312 | + |
313 | 313 | function recursiveBuildTable($title, $level, $ancestry = array()) { |
314 | 314 | $this->call += 1; |
315 | 315 | $ancestry[] = $title; |
— | — | @@ -326,7 +326,7 @@ |
327 | 327 | } |
328 | 328 | $html = "<table $defaultstyle id=\"$summary\" style=\"$initsummarystyle\"><tr><th onclick=\"$jscollapse\">(+)</th><th>$title</th><th></th></tr></table>"; |
329 | 329 | $html .= "<table $defaultstyle id=\"$detail\" style=\"$initdetailstyle\">"; |
330 | | - |
| 330 | + |
331 | 331 | //upstream properties |
332 | 332 | $upstream = $this->ng->getSubjectTriples($title); |
333 | 333 | foreach ($upstream as $property) { |
— | — | @@ -337,16 +337,16 @@ |
338 | 338 | //} else { |
339 | 339 | //recurse here |
340 | 340 | //html .= recursiveBuildTable($source,$level+1,$family); |
341 | | - //} |
| 341 | + //} |
342 | 342 | } |
343 | 343 | $html .= "</td>"; |
344 | 344 | $html .= "<td><i>$property</i></td><td></td>"; |
345 | 345 | $html .= "</tr>"; |
346 | 346 | } |
347 | | - |
| 347 | + |
348 | 348 | // |
349 | 349 | $html .= "<tr><td onclick=\"$jsexpand\">(-)</td><td>$title</td><td></td></tr>"; |
350 | | - |
| 350 | + |
351 | 351 | //downstream properties |
352 | 352 | $downstream = $this->ng->getObjectTriples($title); |
353 | 353 | foreach ($downstream as $property) { |
— | — | @@ -358,12 +358,12 @@ |
359 | 359 | //} else { |
360 | 360 | //recurse here |
361 | 361 | //html .= recursiveBuildTable($dest,$level+1,$family); |
362 | | - //} |
| 362 | + //} |
363 | 363 | } |
364 | 364 | $html .= "</td>"; |
365 | 365 | $html .= "</tr>"; |
366 | 366 | } |
367 | | - |
| 367 | + |
368 | 368 | $html .= "</table>"; |
369 | 369 | return $html; |
370 | 370 | } |
Index: trunk/extensions/SemanticGraph/includes/SemanticGraphSettings.php |
— | — | @@ -42,17 +42,17 @@ |
43 | 43 | ); |
44 | 44 | $this->options = array ( |
45 | 45 | 'smm' => array ( |
46 | | - 'resource' => array ('type' => 'page', 'check' => array('mand','someexist'), |
| 46 | + 'resource' => array ('type' => 'page', 'check' => array('mand','someexist'), |
47 | 47 | 'help' => 'the root node of the mind map'), |
48 | 48 | 'property' => array ('type' => 'page', 'list' => true, 'action' => array('toarray','nsproperty'), 'check' => 'someexist', 'default' => $this->dummyCategoryLinkProperty.",".$this->dummyWikiLinkProperty, |
49 | 49 | 'help' => $commonhelp['property']), |
50 | 50 | 'depth' => array ('type' => 'num', 'default' => 5), |
51 | 51 | 'height' => array ('type' => 'string', 'default' => 450), |
52 | | - 'editform' => array ('type' => 'string', 'default' => false, |
| 52 | + 'editform' => array ('type' => 'string', 'default' => false, |
53 | 53 | 'help' => $commonhelp['editform']), |
54 | | - 'editquery' => array ('type' => 'string', 'default' => false, |
| 54 | + 'editquery' => array ('type' => 'string', 'default' => false, |
55 | 55 | 'help' => $commonhelp['editquery']), |
56 | | - 'fold' => array ('type' => 'string', 'default' => 'large', 'values' => array('level1', 'level2', 'level3', 'none', 'large'), |
| 56 | + 'fold' => array ('type' => 'string', 'default' => 'large', 'values' => array('level1', 'level2', 'level3', 'none', 'large'), |
57 | 57 | 'help' => 'folding of generated map: by default branches with more than 10 items are folded') |
58 | 58 | ), |
59 | 59 | 'sgraph' => array ( |
— | — | @@ -63,16 +63,16 @@ |
64 | 64 | 'depth' => array ('type' => 'num', 'default' => 3, |
65 | 65 | 'help' => 'deep graphs can be expensive'), |
66 | 66 | 'engine' => array ('type' => 'string', 'default' => 'dot', 'values' => array('dot','neato','circo','twopi','fdp')), |
67 | | - 'editform' => array ('type' => 'string', 'default' => false, |
| 67 | + 'editform' => array ('type' => 'string', 'default' => false, |
68 | 68 | 'help' => $commonhelp['editform']), |
69 | | - 'editquery' => array ('type' => 'string', 'default' => false, |
| 69 | + 'editquery' => array ('type' => 'string', 'default' => false, |
70 | 70 | 'help' => $commonhelp['editquery']), |
71 | 71 | 'dotoptions' => array ('type' => 'string', 'default' => "rankdir=LR, ranksep=1;\nnode [fontsize=10, fontname=Helvetica];\n", |
72 | 72 | 'help' => 'a dot string which is inserted at the top of the graph'), |
73 | 73 | 'width' => array ('type' => 'string', 'default' => '800'), |
74 | 74 | 'height' => array ('type' => 'string', 'default' => '600'), |
75 | 75 | 'svg' => array ('type' => 'string', 'default' => 'false'), |
76 | | - 'boxresize' => array ('type' => 'string' , 'default' => 'none', 'values' => array('none','toimage'), |
| 76 | + 'boxresize' => array ('type' => 'string' , 'default' => 'none', 'values' => array('none','toimage'), |
77 | 77 | 'help' => "This option is for svg mode only. ".$commonhelp['boxresize']), |
78 | 78 | 'zoom' => array ('type' => 'string', 'default' => 'tofit' , |
79 | 79 | 'help' => "This option is for svg mode only. ".$commonhelp['zoom']), |
— | — | @@ -81,25 +81,25 @@ |
82 | 82 | 'image' => array ('type' => 'page', 'action' => 'nsimage', 'check' => array('mand','someexist'), |
83 | 83 | 'help' => 'a page name in the image namespace that refers to an uploaded freemind map e.g. Image:map.mm, also map.mm should work'), |
84 | 84 | 'height' => array ('type' => 'string', 'default' => 450), |
85 | | - 'editform' => array ('type' => 'string', 'default' => false, |
| 85 | + 'editform' => array ('type' => 'string', 'default' => false, |
86 | 86 | 'help' => $commonhelp['editform']), |
87 | | - 'editquery' => array ('type' => 'string', 'default' => false, |
| 87 | + 'editquery' => array ('type' => 'string', 'default' => false, |
88 | 88 | 'help' => $commonhelp['editquery']), |
89 | 89 | 'fold' => array ('type' => 'string', 'values' => array('level1', 'level2', 'level3', 'none', 'large')) |
90 | 90 | ), |
91 | 91 | 'shypergraph' => array ( |
92 | 92 | 'resource' => array ('type' => 'page','list' => true, 'action' => 'toarray', 'check' => array('mand','someexist'), |
93 | 93 | 'help' => 'a set of pages that define the initial nodes of the hypergraph. This appears to behave best if it is single'), |
94 | | - 'property' => array ('type' => 'page','list' => true, 'action' => array('toarray','nsproperty'), 'check' => 'someexist', 'default' => $this->dummyCategoryLinkProperty.",".$this->dummyWikiLinkProperty, |
| 94 | + 'property' => array ('type' => 'page','list' => true, 'action' => array('toarray','nsproperty'), 'check' => 'someexist', 'default' => $this->dummyCategoryLinkProperty.",".$this->dummyWikiLinkProperty, |
95 | 95 | 'help' => $commonhelp['property']), |
96 | 96 | 'colours' => array ('type' => 'string', 'list' => true, 'default' => 'black', 'action' => 'toarray', 'values' => $this->colourlist, |
97 | 97 | 'help' => 'a list of colours for the property links - not yet implemented'), |
98 | 98 | 'depth' => array ('type' => 'num', 'default' => 5), |
99 | 99 | 'width' => array ('type' => 'string', 'default' => 800), |
100 | 100 | 'height' => array ('type' => 'string', 'default' => 600), |
101 | | - 'editform' => array ('type' => 'string', 'default' => false, |
| 101 | + 'editform' => array ('type' => 'string', 'default' => false, |
102 | 102 | 'help' => $commonhelp['editform']), |
103 | | - 'editquery' => array ('type' => 'string', 'default' => false, |
| 103 | + 'editquery' => array ('type' => 'string', 'default' => false, |
104 | 104 | 'help' => $commonhelp['editquery']), |
105 | 105 | ), |
106 | 106 | 'bigpic' => array ( |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | 'help' => 'a reference to an image page (that contains an image file!)'), |
109 | 109 | 'width' => array ('type' => 'num', 'default' => null), |
110 | 110 | 'height' => array ('type' => 'num', 'default' => null), |
111 | | - 'boxresize' => array ('type' => 'string' , 'default' => 'none', 'values' => array('none','toimage'), |
| 111 | + 'boxresize' => array ('type' => 'string' , 'default' => 'none', 'values' => array('none','toimage'), |
112 | 112 | 'help' => $commonhelp['boxresize']), |
113 | 113 | 'zoom' => array ('type' => 'string', 'default' => 'tofit' , |
114 | 114 | 'help' => $commonhelp['zoom']), |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | 'dot' => array( |
125 | 125 | 'preamble' => 'digraph "@NAME@" {'."\n", |
126 | 126 | 'nodeExist' => "@CHILD_ID@ [label=\"@CHILD_LABEL@\" URL=\"$wgServer@CHILD_LNK@\", fontcolor=\"blue\"];"."\n", |
127 | | - 'nodeNotExist'=> "@CHILD_ID@ [label=\"@CHILD_LABEL@\" URL=\"$wgServer@FORM_LNK@\", fontcolor=\"red\"];"."\n", |
| 127 | + 'nodeNotExist'=> "@CHILD_ID@ [label=\"@CHILD_LABEL@\" URL=\"$wgServer@FORM_LNK@\", fontcolor=\"red\"];"."\n", |
128 | 128 | 'link' => "@PAR_ID@ -> @CHILD_ID@;"."\n", |
129 | 129 | 'conclusion' => "}"."\n" |
130 | 130 | ), |
— | — | @@ -149,9 +149,9 @@ |
150 | 150 | 'notExistColour' => '#ff0000', |
151 | 151 | ) |
152 | 152 | ); |
153 | | - |
| 153 | + |
154 | 154 | } |
155 | | - |
| 155 | + |
156 | 156 | function usage($functn) { |
157 | 157 | $t = "<p><b>USAGE: {{#$functn:property=value|property=value1,value2,value3|...}}</b></p><table border='1'><tr><th>property</th><th>type</th><th>list</th><th>values</th><th>checks</th><th>help</th></tr>"; |
158 | 158 | foreach ($this->options[$functn] as $rowk => $rowv) { |
— | — | @@ -179,18 +179,18 @@ |
180 | 180 | $t .= '</ul></td>'; |
181 | 181 | } else { |
182 | 182 | $t .= '<td></td>'; |
183 | | - } |
| 183 | + } |
184 | 184 | if (isset($rowv['help'])) { |
185 | 185 | $t .= '<td>'.$rowv['help'].'</td>'; |
186 | 186 | } else { |
187 | 187 | $t .= '<td></td>'; |
188 | | - } |
| 188 | + } |
189 | 189 | $t .= '</tr>'; |
190 | 190 | } |
191 | 191 | $t .= '</table>'; |
192 | 192 | return $t; |
193 | 193 | } |
194 | | - |
| 194 | + |
195 | 195 | function parseOptions( $optarray, $type = 'ERROR' ) { |
196 | 196 | global $wgContLang, $wgScriptPath; |
197 | 197 | array_shift( $optarray ); //first is &$parser, strip it |
— | — | @@ -200,9 +200,9 @@ |
201 | 201 | } |
202 | 202 | if ( !array_key_exists($type, $this->options) ) { |
203 | 203 | $this->lastError = 'unsupported function call '.$type; |
204 | | - return false; |
205 | | - } |
206 | | - |
| 204 | + return false; |
| 205 | + } |
| 206 | + |
207 | 207 | $argv = array(); |
208 | 208 | //populate defaults in output array |
209 | 209 | foreach ((array) $this->options[$type] as $optionk => $optionv) { |
— | — | @@ -227,7 +227,7 @@ |
228 | 228 | foreach ((array) $this->options[$type] as $optionk => $optionv) { |
229 | 229 | if (isset($argv[$optionk])) { |
230 | 230 | //options are now as strings, maybe comma seperated to represent arrays |
231 | | - //sometimes these will be converted to arrays |
| 231 | + //sometimes these will be converted to arrays |
232 | 232 | if (!is_array($argv[$optionk])) { |
233 | 233 | $argv[$optionk] = array($argv[$optionk]); |
234 | 234 | } |
— | — | @@ -235,7 +235,7 @@ |
236 | 236 | if (!isset($optionv['check'])) $optionv['check']=array(); |
237 | 237 | if (!isset($optionv['list'])) $optionv['list']=false; |
238 | 238 | //do actions on output array values |
239 | | - foreach ((array) $optionv['action'] as $action) { |
| 239 | + foreach ((array) $optionv['action'] as $action) { |
240 | 240 | switch ($action) { |
241 | 241 | case 'toarray': |
242 | 242 | |
— | — | @@ -250,17 +250,17 @@ |
251 | 251 | break; // split on whitespace and comma combinations - converts flat csv into an array |
252 | 252 | case 'infermode': |
253 | 253 | //HELLO |
254 | | - //here we do some advanced parsing looking for some assumptions about |
| 254 | + //here we do some advanced parsing looking for some assumptions about |
255 | 255 | //usually property relationships |
256 | 256 | //this assumes that the properties are now an array |
257 | 257 | //?property or property implies focus->property->object |
258 | 258 | //property? implies object->property->focus |
259 | 259 | //?propery? implies either (useful for transitivity) |
260 | | - |
| 260 | + |
261 | 261 | //=as assiging a label? do this first if so. |
262 | 262 | //*as defining transitivity? |
263 | 263 | //?property.?property as defining subrelationships? |
264 | | - |
| 264 | + |
265 | 265 | foreach ($argv[$optionk] as &$prop) { |
266 | 266 | if (strpos($prop,"?")===false) { |
267 | 267 | //this is the default unspecified condition equivalent to a non transitive |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | case 'nscategory': |
274 | 274 | case 'nsform': |
275 | 275 | case 'nsimage': |
276 | | - if ($action == 'nsproperty') $y= SMW_NS_PROPERTY; |
| 276 | + if ($action == 'nsproperty') $y= SMW_NS_PROPERTY; |
277 | 277 | if ($action == 'nscategory') $y= NS_CATEGORY; |
278 | 278 | if ($action == 'nsform') $y= SF_NS_FORM; |
279 | 279 | if ($action == 'nsimage') $y= NS_IMAGE; |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | foreach ($argv[$optionk] as $orig) { |
283 | 283 | $x = explode(":", $orig); |
284 | 284 | if (count($x) == 1) { |
285 | | - $t[] = $y.":".$x[0]; |
| 285 | + $t[] = $y.":".$x[0]; |
286 | 286 | } else { |
287 | 287 | if ($x[0] == $y) { |
288 | 288 | $t[] = $orig; |
— | — | @@ -294,12 +294,12 @@ |
295 | 295 | } |
296 | 296 | $argv[$optionk] = $t; |
297 | 297 | break; |
298 | | - |
| 298 | + |
299 | 299 | } |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | | - |
| 303 | + |
304 | 304 | //do specific checks |
305 | 305 | foreach ((array) $optionv['check'] as $check) { |
306 | 306 | switch ($check) { |
— | — | @@ -314,7 +314,7 @@ |
315 | 315 | // this can be null if it is not mandatory and not set |
316 | 316 | // but if it is not null and no valid page is found then there is an error. |
317 | 317 | // twisted logic. |
318 | | - |
| 318 | + |
319 | 319 | $valid = array(); |
320 | 320 | foreach((array) $argv[$optionk] as $contender) { |
321 | 321 | $temp = Title::newFromText($contender); |
— | — | @@ -343,7 +343,7 @@ |
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | | - |
| 347 | + |
348 | 348 | // chack types and reconvert single elements to variables from arrays |
349 | 349 | if (isset($argv[$optionk])) { |
350 | 350 | $output = null; |
— | — | @@ -378,13 +378,13 @@ |
379 | 379 | } |
380 | 380 | //ok variable initialised and checked for validity |
381 | 381 | //page type variables are held as array of PrefixedDBkeys or a single PrefixedDBkey. |
382 | | - |
| 382 | + |
383 | 383 | $name = ''; |
384 | 384 | if (is_array($argv['resource'])) { |
385 | 385 | foreach ((array) $argv['resource'] as $r) { |
386 | 386 | $name .= $r; |
387 | 387 | } |
388 | | - } else if(isset($argv['resource'])) { |
| 388 | + } elseif(isset($argv['resource'])) { |
389 | 389 | $name .= $argv['resource']; |
390 | 390 | } else { |
391 | 391 | $name .= "noresource"; |
— | — | @@ -401,7 +401,7 @@ |
402 | 402 | $argv['name'] = md5($name); |
403 | 403 | |
404 | 404 | |
405 | | - |
| 405 | + |
406 | 406 | //specific form edit link setup |
407 | 407 | if ($argv['editform'] != false) { |
408 | 408 | $argv['editform'] = $wgScriptPath."/index.php/Special:AddData?form=".$argv['editform']."&target=@CHILD_PAGE@"; |
— | — | @@ -428,7 +428,7 @@ |
429 | 429 | if ($type == 'mm2') { |
430 | 430 | $argv['renderer']='mm'; |
431 | 431 | } |
432 | | - |
| 432 | + |
433 | 433 | return $argv; |
434 | 434 | } |
435 | 435 | } |
Index: trunk/extensions/RDFIO/stores/SMW_ARC2Store.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | |
76 | 76 | if ( $object instanceof SMWExpLiteral ) { |
77 | 77 | $obj_str = "\"" . $object->getName() . "\"" . ( ( $object->getDatatype() == "" ) ? "" : "^^<" . $object->getDatatype() . ">" ); |
78 | | - } else if ( $object instanceof SMWExpResource ) { |
| 78 | + } elseif ( $object instanceof SMWExpResource ) { |
79 | 79 | $obj_str = "<" . SMWExporter::expandURI( $object->getName() ) . ">"; |
80 | 80 | } else { |
81 | 81 | $obj_str = "\"\""; |
Index: trunk/extensions/RDFIO/specials/SpecialSPARQLEndpoint_body.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | $this->importTriplesInQuery(); |
62 | 62 | } |
63 | 63 | $this->printHTMLForm(); |
64 | | - } else if ( $this->m_querytype == 'delete' ) { |
| 64 | + } elseif ( $this->m_querytype == 'delete' ) { |
65 | 65 | if ( $this->checkAllowDelete() ) { |
66 | 66 | $this->deleteTriplesInQuery(); |
67 | 67 | } |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | $this->printQueryStructure(); |
76 | 76 | $executesparql = false; |
77 | 77 | } |
78 | | - } else if ( $this->m_outputtype == 'rdfxml' && $this->m_querytype != 'construct' ) { |
| 78 | + } elseif ( $this->m_outputtype == 'rdfxml' && $this->m_querytype != 'construct' ) { |
79 | 79 | $errormessage = "RDF/XML can only be used with CONSTRUCT, if constructing triples"; |
80 | 80 | $wgOut->addHTML( RDFIOUtils::formatErrorHTML( "Invalid choice", $errormessage ) ); |
81 | 81 | $this->printHTMLForm(); |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | } |
107 | 107 | $output = $this->extractPrepareARCHTMLOutput( $output ); |
108 | 108 | $wgOut->addHTML( $output ); |
109 | | - } else if ( $outputtype == 'rdfxml' ) { |
| 109 | + } elseif ( $outputtype == 'rdfxml' ) { |
110 | 110 | $output_structure = unserialize( $output ); |
111 | 111 | $tripleindex = $output_structure['result']; |
112 | 112 | $triples = ARC2::getTriplesFromIndex( $tripleindex ); |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | function convertURIsInQuery() { |
204 | 204 | if ( $this->m_querybyoriguri ) { |
205 | 205 | $this->convertOrigURIsToInternalURIsInQuery(); |
206 | | - } else if ( $this->m_querybyequivuri ) { |
| 206 | + } elseif ( $this->m_querybyequivuri ) { |
207 | 207 | $query_structure = $this->m_query_parsed; |
208 | 208 | $triple = $query_structure['query']['pattern']['patterns'][0]['patterns'][0]; |
209 | 209 | $s = $triple['s']; |
Index: trunk/extensions/RDFIO/specials/SpecialRDFImport_body.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | if ( $this->m_action == 'Import' ) { |
35 | 35 | if ( !$wgUser->matchEditToken( $this->m_edittoken ) ) { |
36 | 36 | die( 'Cross-site request forgery detected!' ); |
37 | | - } else if ( !$this->m_haswriteaccess ) { |
| 37 | + } elseif ( !$this->m_haswriteaccess ) { |
38 | 38 | $errortitle = "Permission error"; |
39 | 39 | $errormessage = "The current user lacks access either to edit or create pages (or both) in this wiki."; |
40 | 40 | $wgOut->addHTML( RDFIOUtils::formatErrorHTML( $errortitle, $errormessage ) ); |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | $this->executeSMWBatchWriter(); |
62 | 62 | } |
63 | 63 | } |
64 | | - } else if ( $this->m_action == 'AddNsPrefixes' ) { |
| 64 | + } elseif ( $this->m_action == 'AddNsPrefixes' ) { |
65 | 65 | $this->addNewNsPrefixes(); |
66 | 66 | $this->executeSMWBatchWriter(); |
67 | 67 | } else { |
Index: trunk/extensions/RDFIO/bundle/ARC2_SPARQLSerializerPlugin.php |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | case 'literal2': |
109 | 109 | $string .= $this->term_to_string( $t['type'], $t['value'] ); |
110 | 110 | if ( isset( $t['datatype'] ) ) $string .= '^^' . $t['datatype']; |
111 | | - else if ( isset( $t['lang'] ) ) $string .= '@' . $t['lang']; |
| 111 | + elseif ( isset( $t['lang'] ) ) $string .= '@' . $t['lang']; |
112 | 112 | break; |
113 | 113 | case 'expression': |
114 | 114 | $expressions = array(); |
— | — | @@ -132,7 +132,7 @@ |
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | | - else if ( is_array( $t ) ) { |
| 136 | + elseif ( is_array( $t ) ) { |
137 | 137 | foreach ( $t as $item ) { |
138 | 138 | $string .= $this->sparql_info_to_string( $item ); |
139 | 139 | } |
Index: trunk/extensions/RDFIO/classes/SMWBatchWriter.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | $this->m_unparseddata = $this->cleanupXML( $this->m_unparseddata ); |
46 | 46 | $this->m_parser = ARC2::getRDFXMLParser(); |
47 | 47 | $this->parse(); |
48 | | - } else if ( $this->m_dataformat == 'turtle' ) { |
| 48 | + } elseif ( $this->m_dataformat == 'turtle' ) { |
49 | 49 | $this->m_unparseddata = $wgRequest->getText( 'importdata' ); |
50 | 50 | $this->m_parser = ARC2::getTurtleParser(); |
51 | 51 | $this->parse(); |
— | — | @@ -427,7 +427,7 @@ |
428 | 428 | function convertARCTypeToSMWType( $arctype, $arcdatatype ) { |
429 | 429 | if ( $arctype == 'uri' ) { |
430 | 430 | return 'Page'; |
431 | | - } else if ( $arctype == 'literal' ) { |
| 431 | + } elseif ( $arctype == 'literal' ) { |
432 | 432 | if ( $arcdatatype == 'http://www.w3.org/2001/XMLSchema#decimal' ) { |
433 | 433 | return 'Number'; |
434 | 434 | } else { |
— | — | @@ -547,7 +547,7 @@ |
548 | 548 | $titlebypropertyuriindex = $this->getWikiTitleByPropertyURIIndex( $uri ); |
549 | 549 | if ( $titlebypropertyuriindex != '' ) { |
550 | 550 | $wikititle = $titlebypropertyuriindex; |
551 | | - } else if ( ( $this->m_usenspintitles_entities && !$isproperty ) || |
| 551 | + } elseif ( ( $this->m_usenspintitles_entities && !$isproperty ) || |
552 | 552 | ( $this->m_usenspintitles_properties && $isproperty ) ) { |
553 | 553 | $wikititle = $this->abbreviateNSFromURI( $uri ); |
554 | 554 | } else { |
— | — | @@ -632,18 +632,18 @@ |
633 | 633 | |
634 | 634 | if ( $localpart == '' ) { |
635 | 635 | $uri = $basepart; |
636 | | - } else if ( substr( $basepart, 0, 1 ) == '_' ) { |
| 636 | + } elseif ( substr( $basepart, 0, 1 ) == '_' ) { |
637 | 637 | // Change ARC:s default "random string", to indicate more clearly that |
638 | 638 | // it lacks title |
639 | 639 | $uri = str_replace( 'arc', 'untitled', $localpart ); |
640 | | - } else if ( substr( $basepart, 0, 7 ) == 'http://' ) { |
| 640 | + } elseif ( substr( $basepart, 0, 7 ) == 'http://' ) { |
641 | 641 | // If the abbreviation does not seem to have succeeded, |
642 | 642 | // fall back to use only the local part |
643 | 643 | $uri = $localpart; |
644 | | - } else if ( substr( $basepart, -1 ) == ':' ) { |
| 644 | + } elseif ( substr( $basepart, -1 ) == ':' ) { |
645 | 645 | // Don't add another colon |
646 | 646 | $uri = $basepart . $localpart; |
647 | | - } else if ( $basepart == false || $basepart == '' ) { |
| 647 | + } elseif ( $basepart == false || $basepart == '' ) { |
648 | 648 | $uri = $localpart; |
649 | 649 | } else { |
650 | 650 | $uri = $basepart . ':' . $localpart; |
— | — | @@ -664,7 +664,7 @@ |
665 | 665 | |
666 | 666 | if ( $localpart == '' ) { |
667 | 667 | $uri = $basepart; |
668 | | - } else if ( substr( $basepart, 0, 1 ) == '_' ) { |
| 668 | + } elseif ( substr( $basepart, 0, 1 ) == '_' ) { |
669 | 669 | // Change ARC:s default "random string", to indicate more clearly that |
670 | 670 | // it lacks title |
671 | 671 | $uri = str_replace( 'arc', 'untitled', $localpart ); |
— | — | @@ -674,7 +674,7 @@ |
675 | 675 | // If the abbreviation does not seem to have succeeded, |
676 | 676 | // fall back to use only the local part |
677 | 677 | $uri = $localpart; |
678 | | - } else if ( substr( $basepart, -1 ) == ':' ) { |
| 678 | + } elseif ( substr( $basepart, -1 ) == ':' ) { |
679 | 679 | // Don't add another colon |
680 | 680 | $uri = $basepart . $localpart; |
681 | 681 | } else { |
Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Process.php |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | if ( array_key_exists( 'highlightcolor', $params ) ) { |
115 | 115 | $this->m_process->setHighlightColor( trim( $params['highlightcolor'] ) ); |
116 | 116 | } |
117 | | - |
| 117 | + |
118 | 118 | if (array_key_exists('showdiscussion', $params)) { |
119 | 119 | if (self::isTrue($params['showdiscussion'])) $this->m_process->setShowDiscussion(true); |
120 | 120 | } |
— | — | @@ -165,8 +165,8 @@ |
166 | 166 | if ( !is_callable( 'renderGraphviz' ) ) { |
167 | 167 | wfWarn( 'The SRF Graph printer needs the GraphViz extension to be installed.' ); |
168 | 168 | return ''; |
169 | | - } |
170 | | - |
| 169 | + } |
| 170 | + |
171 | 171 | global $wgContLang; // content language object |
172 | 172 | |
173 | 173 | // |
— | — | @@ -210,13 +210,13 @@ |
211 | 211 | } |
212 | 212 | |
213 | 213 | break; |
214 | | - |
| 214 | + |
215 | 215 | case "haslabel": |
216 | 216 | $value = current($field->getContent()); // save only the first |
217 | 217 | if (($value !== false)) { |
218 | 218 | $val = $value->getLongWikiText(); |
219 | 219 | if ($this->m_process->getUseOtherLabels()) { |
220 | | - $val = str_replace("&","and",$val); |
| 220 | + $val = str_replace("&","and",$val); |
221 | 221 | $node->setLabel($val); |
222 | 222 | } |
223 | 223 | } |
— | — | @@ -405,7 +405,7 @@ |
406 | 406 | protected $m_showRedLinks = false; // check and highlight red links? |
407 | 407 | protected $m_redLinkColor = 'red'; // red link font color |
408 | 408 | protected $m_showCompound = true; // highlight compound nodes (=subprocesses) |
409 | | - |
| 409 | + |
410 | 410 | public $m_useHtmlNodes = true; // Set to false if you do not want to use HTML table nodes |
411 | 411 | |
412 | 412 | // instance variables |
— | — | @@ -543,7 +543,7 @@ |
544 | 544 | public function getShowCompound() { |
545 | 545 | return $this->m_showCompound; |
546 | 546 | } |
547 | | - |
| 547 | + |
548 | 548 | public function setShowDiscussion($show){ |
549 | 549 | $this->m_showDiscussion = $show; |
550 | 550 | } |
— | — | @@ -677,7 +677,7 @@ |
678 | 678 | private $m_id = 'no_id'; |
679 | 679 | private $m_label = 'unlabeled'; |
680 | 680 | private $m_uid; |
681 | | - |
| 681 | + |
682 | 682 | public function getUUID(){ |
683 | 683 | if (!isset($this->m_uid)){ |
684 | 684 | $this->m_uid = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
— | — | @@ -686,7 +686,7 @@ |
687 | 687 | mt_rand(0, 0x3fff) | 0x8000, |
688 | 688 | mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); |
689 | 689 | } |
690 | | - |
| 690 | + |
691 | 691 | return $this->m_uid; |
692 | 692 | } |
693 | 693 | public function getId() { |
— | — | @@ -877,13 +877,13 @@ |
878 | 878 | if ( $this->getStatus() != '' ) { |
879 | 879 | if ( $this->getStatus() < 25 ) { |
880 | 880 | $status = ' HREF="[[' . $this->getId() . ']]" TOOLTIP="status '.$this->getStatus().'%"><IMG SRC="' . $PicturePath .'p000.png" /'; |
881 | | - } else if ( $this->getStatus() < 50 ) { |
| 881 | + } elseif ( $this->getStatus() < 50 ) { |
882 | 882 | $status = ' HREF="[[' . $this->getId() . ']]" TOOLTIP="status '.$this->getStatus().'%"><IMG SRC="' . $PicturePath .'p025.png" /'; |
883 | | - } else if ( $this->getStatus() < 75 ) { |
| 883 | + } elseif ( $this->getStatus() < 75 ) { |
884 | 884 | $status = ' HREF="[[' . $this->getId() . ']]" TOOLTIP="status '.$this->getStatus().'%"><IMG SRC="' . $PicturePath .'p050.png" /'; |
885 | | - } else if ( $this->getStatus() < 100 ) { |
| 885 | + } elseif ( $this->getStatus() < 100 ) { |
886 | 886 | $status = ' HREF="[[' . $this->getId() . ']]" TOOLTIP="status '.$this->getStatus().'%"><IMG SRC="' . $PicturePath .'p075.png" /'; |
887 | | - } else if ( $this->getStatus() == 100 ) { |
| 887 | + } elseif ( $this->getStatus() == 100 ) { |
888 | 888 | $status = ' HREF="[[' . $this->getId() . ']]" TOOLTIP="status '.$this->getStatus().'%"><IMG SRC="' . $PicturePath .'p100.png" /'; |
889 | 889 | } |
890 | 890 | } |
— | — | @@ -909,10 +909,10 @@ |
910 | 910 | } else { |
911 | 911 | $discussion = ' HREF="[[Talk:' . $this->getId() . ']]" TOOLTIP="Talk:' . $this->getId() . '"><IMG SRC="' . $PicturePath .'discuss_icon_grey.png" /'; |
912 | 912 | } |
913 | | - |
914 | 913 | |
| 914 | + |
915 | 915 | } |
916 | | - |
| 916 | + |
917 | 917 | // use highlight color if set (either CURRENTPAGE or REDLINK highlighting - see ProcessGraph::makeNode() |
918 | 918 | $high = ''; |
919 | 919 | if ( $this->m_fontColor != '' ) { |
— | — | @@ -931,18 +931,18 @@ |
932 | 932 | } |
933 | 933 | if (!$this->isAtomic()) $compound = '<TR><TD ALIGN="LEFT" BORDER="0" WIDTH="20px" HREF="[['. $this->getId() . ']]" TOOLTIP="sub process"><IMG SRC="' . $PicturePath .'subprocess.png"/>'; |
934 | 934 | } |
935 | | - |
936 | | - |
937 | 935 | |
| 936 | + |
| 937 | + |
938 | 938 | // |
939 | 939 | // render node itself |
940 | 940 | // |
941 | 941 | if ($this->m_process->m_useHtmlNodes){ |
942 | | - $res = |
| 942 | + $res = |
943 | 943 | '"' . $this->getId() . '" [shape=plaintext,label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">' . $compound . '</TD><TD BORDER="0" WIDTH="80%"></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $status . '></TD><TD ALIGN="RIGHT" BORDER="0" WIDTH="20px"' . $discussion . '></TD></TR><TR><TD COLSPAN="4" PORT="port1" HREF="[[' . $this->getId() . ']]" TOOLTIP="' . $this->getLabel() .'"><FONT' . $high .'>' . $this->getLabel() . '</FONT></TD> </TR></TABLE>>]; |
944 | 944 | '; |
945 | 945 | } else { |
946 | | - $res = |
| 946 | + $res = |
947 | 947 | '"' . $this->getId() . '"[label="' . $this->getLabel() . '",shape=rect, height=1.5, URL="[[' . $this->getId() . ']]"]; |
948 | 948 | '; |
949 | 949 | } |
— | — | @@ -1007,18 +1007,18 @@ |
1008 | 1008 | * Abstract base class for edges in a process graph |
1009 | 1009 | */ |
1010 | 1010 | abstract class ProcessEdge{ |
1011 | | - |
| 1011 | + |
1012 | 1012 | private $m_id; |
1013 | 1013 | private $m_uid; |
1014 | | - |
| 1014 | + |
1015 | 1015 | public function getId(){ |
1016 | 1016 | if (!isset($this->m_id)){ |
1017 | 1017 | $this->m_id = 'edge' . rand(1, 99999); |
1018 | 1018 | } |
1019 | | - |
| 1019 | + |
1020 | 1020 | return $this->m_id; |
1021 | 1021 | } |
1022 | | - |
| 1022 | + |
1023 | 1023 | public function getUUID(){ |
1024 | 1024 | if (!isset($this->m_uid)){ |
1025 | 1025 | $this->m_uid = sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
— | — | @@ -1027,21 +1027,21 @@ |
1028 | 1028 | mt_rand(0, 0x3fff) | 0x8000, |
1029 | 1029 | mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)); |
1030 | 1030 | } |
1031 | | - |
| 1031 | + |
1032 | 1032 | return $this->m_uid; |
1033 | 1033 | } |
1034 | | - |
| 1034 | + |
1035 | 1035 | abstract public function getSucc(); |
1036 | 1036 | abstract public function getPred(); |
1037 | | - |
| 1037 | + |
1038 | 1038 | abstract public function getGraphVizCode(); |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | abstract class SplitEdge extends ProcessEdge{ |
1042 | | - |
| 1042 | + |
1043 | 1043 | protected $m_from; |
1044 | 1044 | protected $m_to = array(); |
1045 | | - |
| 1045 | + |
1046 | 1046 | public function setFrom($node){ |
1047 | 1047 | $this->m_from = $node; |
1048 | 1048 | $node->setEdgeOut($this); |
— | — | @@ -1051,32 +1051,32 @@ |
1052 | 1052 | $this->m_to[] = $node; |
1053 | 1053 | $node->addEdgeIn($this); |
1054 | 1054 | } |
1055 | | - |
| 1055 | + |
1056 | 1056 | public function getPred(){ |
1057 | 1057 | return array($this->m_from); |
1058 | 1058 | } |
1059 | | - |
| 1059 | + |
1060 | 1060 | public function getSucc(){ |
1061 | 1061 | return $this->m_to; |
1062 | 1062 | } |
1063 | | - |
| 1063 | + |
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | class SplitConditionalOrEdge extends ProcessEdge{ |
1067 | | - |
| 1067 | + |
1068 | 1068 | protected $m_from; |
1069 | 1069 | protected $m_to_true; |
1070 | 1070 | protected $m_to_false; |
1071 | 1071 | protected $m_con_text = 'empty_condition'; |
1072 | | - |
| 1072 | + |
1073 | 1073 | public function getSucc(){ |
1074 | 1074 | return array($this->m_to_false, $this->m_to_true); |
1075 | 1075 | } |
1076 | | - |
| 1076 | + |
1077 | 1077 | public function getPred(){ |
1078 | | - return array($this->m_from); |
| 1078 | + return array($this->m_from); |
1079 | 1079 | } |
1080 | | - |
| 1080 | + |
1081 | 1081 | public function setFrom($node){ |
1082 | 1082 | $this->m_from = $node; |
1083 | 1083 | $node->setEdgeOut($this); |
— | — | @@ -1097,77 +1097,77 @@ |
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | public function getGraphVizCode(){ |
1101 | | - |
| 1101 | + |
1102 | 1102 | $p = $this->m_from; |
1103 | 1103 | |
1104 | 1104 | if ((!isset($this->m_from)) || (!isset($this->m_to_false)) || (!isset($this->m_to_true))){ |
1105 | | - |
| 1105 | + |
1106 | 1106 | echo "error with SplitConditionalOrEdge"; // TODO |
1107 | | - exit; |
| 1107 | + exit; |
1108 | 1108 | } |
1109 | | - |
1110 | | - |
1111 | | - $res = |
1112 | | - 'subgraph "clus_' . $this->getId() . '" { |
| 1109 | + |
| 1110 | + |
| 1111 | + $res = |
| 1112 | + 'subgraph "clus_' . $this->getId() . '" { |
1113 | 1113 | '; |
1114 | | - |
| 1114 | + |
1115 | 1115 | // cond-Shape |
1116 | 1116 | $con = 'con' . rand(1, 99999); |
1117 | | - $res .= |
1118 | | - '"'. $con . '"[shape=diamond,label="' . $this->m_con_text . '",style=filled,color=skyblue]; |
1119 | | - "' . $p->getId() . '":port1:s -> "'. $con . '"; |
| 1117 | + $res .= |
| 1118 | + '"'. $con . '"[shape=diamond,label="' . $this->m_con_text . '",style=filled,color=skyblue]; |
| 1119 | + "' . $p->getId() . '":port1:s -> "'. $con . '"; |
1120 | 1120 | '; |
1121 | 1121 | |
1122 | | - // True Succ |
| 1122 | + // True Succ |
1123 | 1123 | $res .= |
1124 | 1124 | '"' . $this->m_to_true->getId() . '" [URL = "[['. $this->m_to_true->getId() . ']]"]; |
1125 | 1125 | '; |
1126 | | - |
| 1126 | + |
1127 | 1127 | $res .= |
1128 | 1128 | '"'. $con .'" -> "' . $this->m_to_true->getId() .'":port1:n [label="true"]; |
1129 | 1129 | '; |
1130 | 1130 | |
1131 | | - // False Succ |
| 1131 | + // False Succ |
1132 | 1132 | $res .= |
1133 | 1133 | '"' . $this->m_to_false->getId() . '" [URL = "[['. $this->m_to_false->getId() . ']]"]; |
1134 | 1134 | '; |
1135 | | - |
| 1135 | + |
1136 | 1136 | $res .= |
1137 | 1137 | '"'. $con .'" -> "' . $this->m_to_false->getId() .'":port1:n [label="false"];'; |
1138 | 1138 | |
1139 | | - |
| 1139 | + |
1140 | 1140 | $res .= ' |
1141 | 1141 | } |
1142 | 1142 | '; |
1143 | | - |
| 1143 | + |
1144 | 1144 | return $res; |
1145 | 1145 | } |
1146 | | - |
| 1146 | + |
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | class SplitExclusiveOrEdge extends SplitEdge{ |
1150 | | - |
| 1150 | + |
1151 | 1151 | public function getGraphVizCode(){ |
1152 | 1152 | global $srfgShapeStyle; |
1153 | 1153 | $p = $this->getPred(); |
1154 | 1154 | $p = $p[0]; |
1155 | 1155 | if ($srfgShapeStyle=='') $srfgShapeStyle="box"; |
1156 | | - $res = |
1157 | | - 'subgraph "clus_' . $this->getId() . '" { |
| 1156 | + $res = |
| 1157 | + 'subgraph "clus_' . $this->getId() . '" { |
1158 | 1158 | '; |
1159 | | - |
| 1159 | + |
1160 | 1160 | // add OR-Shape |
1161 | 1161 | $orx = 'or' . rand(1, 99999); |
1162 | | - $res .= |
1163 | | - '"'. $orx . '"[shape=' . $srfgShapeStyle . ',label="+",style=filled,color=gold]; |
1164 | | - "' . $p->getId() . '":port1:s -> "'. $orx . '"; |
| 1162 | + $res .= |
| 1163 | + '"'. $orx . '"[shape=' . $srfgShapeStyle . ',label="+",style=filled,color=gold]; |
| 1164 | + "' . $p->getId() . '":port1:s -> "'. $orx . '"; |
1165 | 1165 | '; |
1166 | | - |
| 1166 | + |
1167 | 1167 | foreach ($this->getSucc() as $s){ |
1168 | 1168 | $res .= |
1169 | 1169 | '"' . $s->getId() . '" [URL="[['. $s->getId() . ']]"]; |
1170 | 1170 | '; |
1171 | | - |
| 1171 | + |
1172 | 1172 | $res .= |
1173 | 1173 | '"'. $orx .'" -> "' . $s->getId() .'":port1:n; |
1174 | 1174 | '; |
— | — | @@ -1179,43 +1179,43 @@ |
1180 | 1180 | |
1181 | 1181 | return $res; |
1182 | 1182 | } |
1183 | | - |
| 1183 | + |
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | class SplitParallelEdge extends SplitEdge{ |
1187 | | - |
1188 | 1187 | |
| 1188 | + |
1189 | 1189 | public function getGraphVizCode(){ |
1190 | 1190 | global $srfgShapeStyle; |
1191 | 1191 | if ($srfgShapeStyle=='') $srfgShapeStyle="box"; |
1192 | 1192 | $p = $this->getPred(); |
1193 | 1193 | $p = $p[0]; |
1194 | 1194 | |
1195 | | - $res = |
1196 | | - 'subgraph "clus_' . $this->getId() . '" { |
| 1195 | + $res = |
| 1196 | + 'subgraph "clus_' . $this->getId() . '" { |
1197 | 1197 | '; |
1198 | | - |
| 1198 | + |
1199 | 1199 | // add AND-Shape |
1200 | 1200 | $and = 'and' . rand(1, 99999); |
1201 | | - $res .= |
1202 | | - '"'. $and . '"[shape=' . $srfgShapeStyle . ',label="||",style=filled,color=palegreen]; |
1203 | | - "' . $p->getId() . '":port1:s -> "'. $and . '"; |
| 1201 | + $res .= |
| 1202 | + '"'. $and . '"[shape=' . $srfgShapeStyle . ',label="||",style=filled,color=palegreen]; |
| 1203 | + "' . $p->getId() . '":port1:s -> "'. $and . '"; |
1204 | 1204 | '; |
1205 | | - |
| 1205 | + |
1206 | 1206 | foreach ($this->getSucc() as $s){ |
1207 | 1207 | $res .= |
1208 | 1208 | '"' . $s->getId() . '" [URL = "[['. $s->getId() . ']]"]; |
1209 | 1209 | '; |
1210 | | - |
| 1210 | + |
1211 | 1211 | $res .= |
1212 | 1212 | '"'. $and .'" -> "' . $s->getId() .'":port1:n; |
1213 | 1213 | '; |
1214 | 1214 | } |
1215 | | - |
| 1215 | + |
1216 | 1216 | $res .= ' |
1217 | 1217 | } |
1218 | 1218 | '; |
1219 | | - |
| 1219 | + |
1220 | 1220 | return $res; |
1221 | 1221 | } |
1222 | 1222 | |
— | — | @@ -1225,45 +1225,45 @@ |
1226 | 1226 | |
1227 | 1227 | private $m_from; |
1228 | 1228 | private $m_to; |
1229 | | - |
| 1229 | + |
1230 | 1230 | public function setFrom($node){ |
1231 | 1231 | $this->m_from = $node; |
1232 | 1232 | $node->setEdgeOut($this); |
1233 | 1233 | } |
1234 | | - |
| 1234 | + |
1235 | 1235 | public function setTo($node){ |
1236 | 1236 | $this->m_to = $node; |
1237 | 1237 | $node->addEdgeIn($this); |
1238 | 1238 | } |
1239 | | - |
| 1239 | + |
1240 | 1240 | public function getPred(){ |
1241 | 1241 | return array($this->m_from); |
1242 | 1242 | } |
1243 | | - |
| 1243 | + |
1244 | 1244 | public function getSucc(){ |
1245 | 1245 | return array($this->m_to); |
1246 | 1246 | } |
1247 | | - |
| 1247 | + |
1248 | 1248 | public function getGraphVizCode(){ |
1249 | | - |
| 1249 | + |
1250 | 1250 | $p = $this->m_from; |
1251 | 1251 | $s = $this->m_to; |
1252 | | - |
1253 | | - $res = |
1254 | | - 'subgraph "clus_' . $this->getId() . '" { |
| 1252 | + |
| 1253 | + $res = |
| 1254 | + 'subgraph "clus_' . $this->getId() . '" { |
1255 | 1255 | '; |
1256 | | - |
| 1256 | + |
1257 | 1257 | $res .= |
1258 | 1258 | '"' . $s->getId() . '" [URL = "[['. $s->getId() . ']]"]; |
1259 | 1259 | '; |
1260 | | - |
| 1260 | + |
1261 | 1261 | $res .= |
1262 | 1262 | '"'. $p->getId() .'":port1:s -> "' . $s->getId() .'":port1:n;'; |
1263 | | - |
| 1263 | + |
1264 | 1264 | $res .= ' |
1265 | 1265 | } |
1266 | 1266 | '; |
1267 | | - |
| 1267 | + |
1268 | 1268 | return $res; |
1269 | 1269 | } |
1270 | 1270 | |
Index: trunk/extensions/SemanticResultFormats/Exhibit/SRF_Exhibit.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | if ( $row != null ) { |
37 | 37 | $tmp = clone $row[0]; |
38 | 38 | $object = efSRFGetNextDV( $tmp ); |
39 | | - |
| 39 | + |
40 | 40 | if ( $object instanceof SMWWikiPageValue ) { |
41 | 41 | $value = $object->getPrefixedText(); |
42 | 42 | if ( strpos( $value, ':' ) ) { |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | if ( sizeof( $dates ) == 1 ) { |
204 | 204 | $tlparams[] = 'ex:start=\'.' . $this->encodePropertyName( $dates[0]->getLabel() ) . '\' '; |
205 | 205 | } |
206 | | - else if ( sizeof( $dates ) == 2 ) { |
| 206 | + elseif ( sizeof( $dates ) == 2 ) { |
207 | 207 | $tlparams[] = 'ex:start=\'.' . $this->encodePropertyName( $dates[0]->getLabel() ) . '\' '; |
208 | 208 | $tlparams[] = 'ex:end=\'.' . $this->encodePropertyName( $dates[1]->getLabel() ) . '\' '; |
209 | 209 | } |
Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -2,10 +2,10 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Result printer that prints query results as a gallery. |
6 | | - * |
| 6 | + * |
7 | 7 | * @file SRF_Gallery.php |
8 | 8 | * @ingroup SemanticResultFormats |
9 | | - * |
| 9 | + * |
10 | 10 | * @author Rowan Rodrik van der Molen |
11 | 11 | * @author Jeroen De Dauw |
12 | 12 | */ |
— | — | @@ -34,25 +34,25 @@ |
35 | 35 | if ( isset( $this->m_params['perrow'] ) ) { |
36 | 36 | $ig->setPerRow( $this->m_params['perrow'] ); |
37 | 37 | } |
38 | | - |
| 38 | + |
39 | 39 | if ( isset( $this->m_params['widths'] ) ) { |
40 | 40 | $ig->setWidths( $this->m_params['widths'] ); |
41 | 41 | } |
42 | | - |
| 42 | + |
43 | 43 | if ( isset( $this->m_params['heights'] ) ) { |
44 | 44 | $ig->setHeights( $this->m_params['heights'] ); |
45 | 45 | } |
46 | | - |
47 | | - $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? $this->m_params['autocaptions'] != 'off' : true; |
48 | 46 | |
| 47 | + $this->m_params['autocaptions'] = isset( $this->m_params['autocaptions'] ) ? $this->m_params['autocaptions'] != 'off' : true; |
| 48 | + |
49 | 49 | $printReqLabels = array(); |
50 | | - |
| 50 | + |
51 | 51 | foreach ( $results->getPrintRequests() as $printReq ) { |
52 | 52 | $printReqLabels[] = $printReq->getLabel(); |
53 | | - } |
| 53 | + } |
54 | 54 | |
55 | 55 | if ( isset( $this->m_params['imageproperty'] ) && in_array( $this->m_params['imageproperty'], $printReqLabels ) ) { |
56 | | - $captionProperty = isset( $this->m_params['captionproperty'] ) ? $this->m_params['captionproperty'] : ''; |
| 56 | + $captionProperty = isset( $this->m_params['captionproperty'] ) ? $this->m_params['captionproperty'] : ''; |
57 | 57 | $this->addImageProperties( $results, $ig, $this->m_params['imageproperty'], $captionProperty ); |
58 | 58 | } |
59 | 59 | else { |
— | — | @@ -61,12 +61,12 @@ |
62 | 62 | |
63 | 63 | return array( $ig->toHTML(), 'nowiki' => true, 'isHTML' => true ); |
64 | 64 | } |
65 | | - |
| 65 | + |
66 | 66 | /** |
67 | | - * Handles queries where the images (and optionally their captions) are specified as properties. |
68 | | - * |
| 67 | + * Handles queries where the images (and optionally their captions) are specified as properties. |
| 68 | + * |
69 | 69 | * @since 1.5.3 |
70 | | - * |
| 70 | + * |
71 | 71 | * @param SMWQueryResult $results |
72 | 72 | * @param ImageGallery $ig |
73 | 73 | * @param string $imageProperty |
— | — | @@ -76,39 +76,39 @@ |
77 | 77 | while ( /* array of SMWResultArray */ $row = $results->getNext() ) { // Objects (pages) |
78 | 78 | $images = array(); |
79 | 79 | $captions = array(); |
80 | | - |
| 80 | + |
81 | 81 | for ( $i = 0, $n = count( $row ); $i < $n; $i++ ) { // Properties |
82 | 82 | if ( $row[$i]->getPrintRequest()->getLabel() == $imageProperty ) { |
83 | 83 | while ( ( $obj = efSRFGetNextDV( $row[$i] ) ) !== false ) { // Property values |
84 | 84 | if ( $obj->getTypeID() == '_wpg' ) { |
85 | | - $images[] = $obj->getTitle(); |
86 | | - } |
87 | | - } |
| 85 | + $images[] = $obj->getTitle(); |
| 86 | + } |
| 87 | + } |
88 | 88 | } |
89 | | - else if ( $row[$i]->getPrintRequest()->getLabel() == $captionProperty ) { |
| 89 | + elseif ( $row[$i]->getPrintRequest()->getLabel() == $captionProperty ) { |
90 | 90 | while ( ( $obj = efSRFGetNextDV( $row[$i] ) ) !== false ) { // Property values |
91 | 91 | $captions[] = $obj->getShortText( SMW_OUTPUT_HTML, $this->getLinker( true ) ); |
92 | | - } |
| 92 | + } |
93 | 93 | } |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | $amountMatches = count( $captions ) == count( $images ); |
97 | 97 | $hasCaption = $amountMatches || count( $captions ) > 0; |
98 | | - |
| 98 | + |
99 | 99 | foreach ( $images as $imgTitle ) { |
100 | 100 | if ( $imgTitle->exists() ) { |
101 | 101 | $imgCaption= $hasCaption ? ( $amountMatches ? array_shift( $captions ) : $captions[0] ) : ''; |
102 | | - $this->addImageToGallery( $ig, $imgTitle, $imgCaption ); |
| 102 | + $this->addImageToGallery( $ig, $imgTitle, $imgCaption ); |
103 | 103 | } |
104 | | - } |
| 104 | + } |
105 | 105 | } |
106 | 106 | } |
107 | | - |
| 107 | + |
108 | 108 | /** |
109 | 109 | * Handles queries where the result objects are image pages. |
110 | | - * |
| 110 | + * |
111 | 111 | * @since 1.5.3 |
112 | | - * |
| 112 | + * |
113 | 113 | * @param SMWQueryResult $results |
114 | 114 | * @param ImageGallery $ig |
115 | 115 | */ |
— | — | @@ -116,11 +116,11 @@ |
117 | 117 | while ( $row = $results->getNext() ) { |
118 | 118 | $firstField = $row[0]; |
119 | 119 | $nextObject = efSRFGetNextDV( $firstField ); |
120 | | - |
| 120 | + |
121 | 121 | if ( $nextObject !== false ) { |
122 | 122 | $imgTitle = $nextObject->getTitle(); |
123 | 123 | $imgCaption = ''; |
124 | | - |
| 124 | + |
125 | 125 | // Is there a property queried for display with ?property |
126 | 126 | if ( isset( $row[1] ) ) { |
127 | 127 | $imgCaption = efSRFGetNextDV( $row[1] ); |
— | — | @@ -128,25 +128,25 @@ |
129 | 129 | $imgCaption = $imgCaption->getShortText( SMW_OUTPUT_HTML, $this->getLinker( true ) ); |
130 | 130 | } |
131 | 131 | } |
132 | | - |
133 | | - $this->addImageToGallery( $ig, $imgTitle, $imgCaption ); |
| 132 | + |
| 133 | + $this->addImageToGallery( $ig, $imgTitle, $imgCaption ); |
134 | 134 | } |
135 | | - } |
| 135 | + } |
136 | 136 | } |
137 | | - |
| 137 | + |
138 | 138 | /** |
139 | 139 | * Adds a single image to the gallery. |
140 | 140 | * Takes care of automatically adding a caption when none is provided and parsing it's wikitext. |
141 | | - * |
| 141 | + * |
142 | 142 | * @since 1.5.3 |
143 | | - * |
| 143 | + * |
144 | 144 | * @param ImageGallery $ig The gallery to add the image to |
145 | 145 | * @param Title $imgTitle The title object of the page of the image |
146 | 146 | * @param string $imgCaption An optional caption for the image |
147 | 147 | */ |
148 | 148 | protected function addImageToGallery( ImageGallery &$ig, Title $imgTitle, $imgCaption ) { |
149 | 149 | global $wgParser; |
150 | | - |
| 150 | + |
151 | 151 | if ( empty( $imgCaption ) ) { |
152 | 152 | $imgCaption = $this->m_params['autocaptions'] ? preg_replace( '#\.[^.]+$#', '', $imgTitle->getBaseText() ) : ''; |
153 | 153 | } |
— | — | @@ -161,30 +161,30 @@ |
162 | 162 | $wgParser->mOutput->addImage( $imgTitle->getDBkey() ); |
163 | 163 | } |
164 | 164 | } |
165 | | - |
| 165 | + |
166 | 166 | /** |
167 | 167 | * @see SMWResultPrinter::getParameters |
168 | | - * |
| 168 | + * |
169 | 169 | * @since 1.5.3 |
170 | | - * |
| 170 | + * |
171 | 171 | * @return array |
172 | | - */ |
| 172 | + */ |
173 | 173 | public function getParameters() { |
174 | 174 | $params = parent::getParameters(); |
175 | | - |
| 175 | + |
176 | 176 | if ( defined( 'SMW_SUPPORTS_VALIDATOR' ) ) { |
177 | 177 | $params['perrow'] = new Parameter( 'perrow', Parameter::TYPE_INTEGER ); |
178 | 178 | $params['perrow']->setDescription( wfMsg( 'srf_paramdesc_perrow' ) ); |
179 | 179 | $params['perrow']->setDefault( '', false ); |
180 | | - |
| 180 | + |
181 | 181 | $params['widths'] = new Parameter( 'widths', Parameter::TYPE_INTEGER ); |
182 | 182 | $params['widths']->setDescription( wfMsg( 'srf_paramdesc_widths' ) ); |
183 | 183 | $params['widths']->setDefault( '', false ); |
184 | | - |
| 184 | + |
185 | 185 | $params['heights'] = new Parameter( 'heights', Parameter::TYPE_INTEGER ); |
186 | 186 | $params['heights']->setDescription( wfMsg( 'srf_paramdesc_heights' ) ); |
187 | 187 | $params['heights']->setDefault( '', false ); |
188 | | - |
| 188 | + |
189 | 189 | $params['autocaptions'] = new Parameter( 'autocaptions', Parameter::TYPE_BOOLEAN ); |
190 | 190 | $params['autocaptions']->setDescription( wfMsg( 'srf_paramdesc_autocaptions' ) ); |
191 | 191 | $params['autocaptions']->setDefault( true ); |
— | — | @@ -194,11 +194,11 @@ |
195 | 195 | $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) ); |
196 | 196 | $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) ); |
197 | 197 | $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) ); |
198 | | - |
199 | | - $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) ); |
| 198 | + |
| 199 | + $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) ); |
200 | 200 | } |
201 | | - |
| 201 | + |
202 | 202 | return $params; |
203 | | - } |
204 | | - |
| 203 | + } |
| 204 | + |
205 | 205 | } |
Index: trunk/extensions/RT/RT_body.php |
— | — | @@ -9,10 +9,10 @@ |
10 | 10 | $parser->setHook( 'rt', array( 'RT::render' ) ); |
11 | 11 | return true; |
12 | 12 | } |
13 | | - |
| 13 | + |
14 | 14 | // This is called to process <rt>...</rt> within a page |
15 | 15 | public static function render( $input, $args = array(), $parser = null ) { |
16 | | - |
| 16 | + |
17 | 17 | global $wgRequestTracker_Cachepage, |
18 | 18 | $wgRequestTracker_Active, |
19 | 19 | $wgRequestTracker_DBconn, |
— | — | @@ -24,21 +24,21 @@ |
25 | 25 | $wgRequestTracker_TIMEFORMAT_RESOLVED, |
26 | 26 | $wgRequestTracker_TIMEFORMAT_RESOLVED2, |
27 | 27 | $wgRequestTracker_TIMEFORMAT_NOW; |
28 | | - |
29 | | - |
30 | | - |
| 28 | + |
| 29 | + |
| 30 | + |
31 | 31 | // Grab the number if one was given between the <tr> tags |
32 | 32 | $ticketnum = 0; |
33 | 33 | $matches = array(); |
34 | 34 | if ( preg_match( '/^\s*(\d+)\s*$/', $input, $matches ) ) { |
35 | 35 | $ticketnum = $matches[0]; |
36 | 36 | } |
37 | | - |
| 37 | + |
38 | 38 | // Disable all caching unless told not to |
39 | 39 | if ( !$wgRequestTracker_Cachepage ) { |
40 | 40 | $parser->disableCache(); |
41 | 41 | } |
42 | | - |
| 42 | + |
43 | 43 | // Try and connect to the database if we are active |
44 | 44 | if ( $wgRequestTracker_Active ) { |
45 | 45 | global $wgUser; |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
65 | | - |
| 65 | + |
66 | 66 | // If we are not 'active', we leave right away, with minimal output |
67 | 67 | if ( !$wgRequestTracker_Active ) { |
68 | 68 | if ( $ticketnum ) { |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $msg = wfMsg( 'rt-inactive' ); |
72 | 72 | return "<table class='rt-table-inactive' border='1'><tr><td>$msg</td></tr></table>"; |
73 | 73 | } |
74 | | - |
| 74 | + |
75 | 75 | // Standard info we gather |
76 | 76 | $TZ = "AT TIME ZONE 'GMT'"; |
77 | 77 | $ticketinfo = 't.id, t.subject, t.priority, INITCAP(t.status) AS status, q.name AS queue,' |
— | — | @@ -92,17 +92,17 @@ |
93 | 93 | . " CASE WHEN (now() $TZ - t.created) <= '2 hour'::interval THEN EXTRACT(minutes FROM now() $TZ - t.created) || ' minutes' ELSE" |
94 | 94 | . " CASE WHEN (now() $TZ - t.created) <= '2 day'::interval THEN EXTRACT(hours FROM now() $TZ - t.created) || ' hours' ELSE" |
95 | 95 | . " EXTRACT(days FROM now() $TZ - t.created) || ' days' END END END END AS age"; |
96 | | - |
| 96 | + |
97 | 97 | $ticketquery = "SELECT $ticketinfo\nFROM tickets t, queues q, users u, users u2"; |
98 | 98 | $whereclause = "WHERE t.queue = q.id\nAND t.owner = u.id\nAND t.creator = u2.id"; |
99 | | - |
| 99 | + |
100 | 100 | // If just a single number, treat it as <rt>#</rt> |
101 | 101 | if ( 1 === count( $args ) ) { |
102 | 102 | if ( preg_match( '/^\d+$/', key( $args ) ) ) { |
103 | 103 | $ticketnum = key( $args ); |
104 | 104 | } |
105 | 105 | } |
106 | | - |
| 106 | + |
107 | 107 | // Look up a single ticket number |
108 | 108 | if ( $ticketnum ) { |
109 | 109 | $SQL = "$ticketquery $whereclause\nAND t.id = $ticketnum"; |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | } |
118 | 118 | return self::fancyLink( $info, $args, $parser, 0 ); |
119 | 119 | } |
120 | | - |
| 120 | + |
121 | 121 | // Add in a LIMIT clause if l=xx or limit=xx was used |
122 | 122 | $limit = ''; |
123 | 123 | if ( array_key_exists( 'limit', $args ) ) { |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | } |
131 | 131 | $limit = " LIMIT $limit"; |
132 | 132 | } |
133 | | - |
| 133 | + |
134 | 134 | // Change the default ORDER BY clause if ob=xx was used |
135 | 135 | $orderby = 'ORDER BY t.lastupdated DESC, t.id'; |
136 | 136 | $valid_orderby = array |
— | — | @@ -158,14 +158,14 @@ |
159 | 159 | if ( array_key_exists( $word, $valid_orderby ) ) { |
160 | 160 | $word = $valid_orderby[$word]; |
161 | 161 | } |
162 | | - else if ( !preg_match ( '/^\d+$/', $word ) ) { |
| 162 | + elseif ( !preg_match ( '/^\d+$/', $word ) ) { |
163 | 163 | die ( wfMsg ( 'rt-badorderby', $word ) ); |
164 | 164 | } |
165 | 165 | $orderby .= " $word$mod,"; |
166 | 166 | } |
167 | 167 | $orderby = rtrim( $orderby, ',' ); |
168 | 168 | } |
169 | | - |
| 169 | + |
170 | 170 | // Determine what status to use. Default is new and open: |
171 | 171 | $searchstatus = "t.status IN ('new','open')"; |
172 | 172 | $valid_status = array( 'new', 'open', 'resolved', 'deleted', 'stalled', 'rejected' ); |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | $searchq = preg_replace( '/.$/', ')', $searchq ); |
206 | 206 | $whereclause .= "\nAND $searchq"; |
207 | 207 | } |
208 | | - |
| 208 | + |
209 | 209 | // See if we are limiting to one or more owners |
210 | 210 | $searchowner = ''; |
211 | 211 | if ( array_key_exists( 'o', $args ) ) { |
— | — | @@ -220,7 +220,7 @@ |
221 | 221 | $searchowner = preg_replace( '/.$/', ')', $searchowner ); |
222 | 222 | $whereclause .= "\nAND $searchowner"; |
223 | 223 | } |
224 | | - |
| 224 | + |
225 | 225 | // Allow use of custom fields |
226 | 226 | $searchcustom = ''; |
227 | 227 | if ( array_key_exists('custom', $args ) ) { |
— | — | @@ -265,7 +265,7 @@ |
266 | 266 | && !array_key_exists( 'queue', $args ) ) ) { |
267 | 267 | $showqueue = 0; |
268 | 268 | } |
269 | | - |
| 269 | + |
270 | 270 | // The owner: show by default unless searching a single owner |
271 | 271 | $showowner = 1; |
272 | 272 | if ( array_key_exists( 'noowner', $args ) |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | && !array_key_exists( 'owner', $args ) ) ) { |
276 | 276 | $showowner = 0; |
277 | 277 | } |
278 | | - |
| 278 | + |
279 | 279 | // The status: show by default unless searching a single status |
280 | 280 | $showstatus = 1; |
281 | 281 | if ( array_key_exists( 'nostatus', $args ) |
— | — | @@ -282,12 +282,12 @@ |
283 | 283 | && !array_key_exists( 'status', $args ) ) ) { |
284 | 284 | $showstatus = 0; |
285 | 285 | } |
286 | | - |
| 286 | + |
287 | 287 | // Things we always show unless told not to: |
288 | 288 | $showsubject = ! array_key_exists( 'nosubject', $args ); |
289 | 289 | $showupdated = ! array_key_exists( 'noupdated', $args ); |
290 | 290 | $showticket = ! array_key_exists( 'noticket', $args ); |
291 | | - |
| 291 | + |
292 | 292 | // Things we don't show unless asked to: |
293 | 293 | $showpriority = array_key_exists( 'priority', $args ); |
294 | 294 | $showupdated2 = array_key_exists( 'updated2', $args ); |
— | — | @@ -297,10 +297,10 @@ |
298 | 298 | $showresolved2 = array_key_exists( 'resolved2', $args ); |
299 | 299 | $showage = array_key_exists( 'age', $args ); |
300 | 300 | $showcustom = array_key_exists( 'custom', $args ); |
301 | | - |
| 301 | + |
302 | 302 | // Unless 'tablerows' has been set, output the table and header tags |
303 | 303 | if ( !array_key_exists( 'tablerows', $args ) ) { |
304 | | - |
| 304 | + |
305 | 305 | $class = $wgRequestTracker_Sortable ? 'wikitable sortable' : 'rt-table'; |
306 | 306 | |
307 | 307 | // Allow override of the default sortable table option |
— | — | @@ -333,12 +333,12 @@ |
334 | 334 | if ( $showresolved ) { $output .= "<th style='white-space: nowrap'>Resolved</th>\n"; } |
335 | 335 | if ( $showresolved2 ) { $output .= "<th style='white-space: nowrap'>Resolved</th>\n"; } |
336 | 336 | if ( $showage ) { $output .= "<th style='white-space: nowrap'>Age</th>\n"; } |
337 | | - |
| 337 | + |
338 | 338 | $output .= "</tr>\n"; |
339 | 339 | } |
340 | | - |
| 340 | + |
341 | 341 | foreach ( $info as $row ) { |
342 | | - |
| 342 | + |
343 | 343 | if ( $showticket ) { |
344 | 344 | $id = self::fancyLink( $row, $args, $parser, 1 ); |
345 | 345 | $output .= "<td style='white-space: nowrap'>$id</td>"; |
— | — | @@ -367,21 +367,21 @@ |
368 | 368 | if ( $showage ) { $output .= '<td>' . $row['age'] . "</td>\n"; } |
369 | 369 | $output .= "\n</tr>\n"; |
370 | 370 | } |
371 | | - |
| 371 | + |
372 | 372 | if ( !array_key_exists( 'tablerows', $args ) ) { |
373 | 373 | $output .= "\n</table>\n"; |
374 | 374 | } |
375 | | - |
| 375 | + |
376 | 376 | return $output; |
377 | 377 | } |
378 | 378 | |
379 | 379 | private static function fancyLink( $row, $args, $parser, $istable ) { |
380 | | - |
| 380 | + |
381 | 381 | global $wgRequestTracker_URL, $wgRequestTracker_Formats, $wgRequestTracker_Useballoons; |
382 | | - |
| 382 | + |
383 | 383 | $ticketnum = $row['id']; |
384 | 384 | $ret = "[$wgRequestTracker_URL=$ticketnum RT #$ticketnum]"; |
385 | | - |
| 385 | + |
386 | 386 | # Check for any custom format args in the rt tag. |
387 | 387 | # If any are found, use that and ignore any other args |
388 | 388 | $foundformat = 0; |
— | — | @@ -396,7 +396,7 @@ |
397 | 397 | break; |
398 | 398 | } |
399 | 399 | } |
400 | | - |
| 400 | + |
401 | 401 | # Process any column-based args to the rt tag |
402 | 402 | if ( !$foundformat and !$istable ) { |
403 | 403 | foreach ( array_keys( $args ) as $val ) { |
— | — | @@ -412,18 +412,18 @@ |
413 | 413 | } |
414 | 414 | } |
415 | 415 | } |
416 | | - |
| 416 | + |
417 | 417 | $ret = $parser->recursiveTagParse( $ret ); |
418 | | - |
| 418 | + |
419 | 419 | // Not using balloons? Just return the current text |
420 | 420 | if ( !$wgRequestTracker_Useballoons || array_key_exists( 'noballoon', $args ) ) { |
421 | 421 | return "<span class='rt-ticket-noballoon'>$ret</span>"; |
422 | 422 | } |
423 | | - |
| 423 | + |
424 | 424 | $safesub = preg_replace( '/\"/', '\"', $row['subject'] ); |
425 | 425 | $safesub = preg_replace( '/\'/', "\'", $safesub ); |
426 | 426 | $safesub = htmlspecialchars( $safesub ); |
427 | | - |
| 427 | + |
428 | 428 | $safeowner = $row['owner']; |
429 | 429 | if ( $row['owner'] !== $row['username'] ) { |
430 | 430 | $safeowner .= " ($row[username])"; |
— | — | @@ -431,11 +431,11 @@ |
432 | 432 | $safeowner = preg_replace( '/\"/', '\"', $safeowner ); |
433 | 433 | $safeowner = preg_replace( '/\'/', "\'", $safeowner ); |
434 | 434 | $safeowner = htmlspecialchars( $safeowner ); |
435 | | - |
| 435 | + |
436 | 436 | $safeq = preg_replace( '/\"/', '\"', $row['queue'] ); |
437 | 437 | $safeq = preg_replace( '/\'/', "\'", $safeq ); |
438 | 438 | $safeq = htmlspecialchars( $safeq ); |
439 | | - |
| 439 | + |
440 | 440 | $text = "RT #<b>$ticketnum</b>"; |
441 | 441 | $text .= "<br />Status: <b>$row[status]</b>"; |
442 | 442 | $text .= "<br />Subject: <b>$safesub</b>"; |
— | — | @@ -448,26 +448,26 @@ |
449 | 449 | else { |
450 | 450 | $text .= "<br />Last updated: <b>$row[lastupdated]</b>"; |
451 | 451 | } |
452 | | - |
| 452 | + |
453 | 453 | # Prepare some balloon-tek |
454 | 454 | $link = isset( $args['link'] ) ? $args['link'] : ''; |
455 | 455 | $target = isset( $args['target'] ) ? $args['target'] : ''; |
456 | 456 | $sticky = isset( $args['sticky'] ) ? $args['sticky'] : '0'; |
457 | 457 | $width = isset( $args['width'] ) ? $args['width'] : '0'; |
458 | | - |
| 458 | + |
459 | 459 | $event = isset( $args['click'] ) && $args['click'] && !$link ? 'onclick' : 'onmouseover'; |
460 | 460 | $event2 = ''; |
461 | 461 | $event = "$event=\"balloon.showTooltip(event,'${text}',${sticky},${width})\""; |
462 | | - |
| 462 | + |
463 | 463 | if ( preg_match( '/onclick/', $event ) && $args['hover'] ) { |
464 | 464 | $event2 = " onmouseover=\"balloon.showTooltip(event,'" . $args['hover'] . "',0,${width})\""; |
465 | 465 | } |
466 | | - |
| 466 | + |
467 | 467 | $has_style = isset( $args['style'] ) && $args['style']; |
468 | 468 | $style = "style=\"" . ( $has_style ? $args['style'] . ";cursor:pointer\"" : "cursor:pointer\"" ); |
469 | 469 | $target = $target ? "target=${target}" : ''; |
470 | 470 | $output = "<span class='rt-ticket' ${event} ${event2} ${style}>$ret</span>"; |
471 | | - |
| 471 | + |
472 | 472 | return $output; |
473 | 473 | } |
474 | 474 | } |
\ No newline at end of file |
Index: trunk/extensions/RefreshSpecial/RefreshSpecial.body.php |
— | — | @@ -25,8 +25,8 @@ |
26 | 26 | public function execute( $par ) { |
27 | 27 | global $wgOut, $wgUser, $wgRequest; |
28 | 28 | |
29 | | - |
30 | 29 | |
| 30 | + |
31 | 31 | $wgOut->setPageTitle( wfMsg( 'refreshspecial-title' ) ); |
32 | 32 | |
33 | 33 | # If the user doesn't have the required permission, display an error |
— | — | @@ -52,9 +52,9 @@ |
53 | 53 | $action = $wgRequest->getVal( 'action' ); |
54 | 54 | if( 'success' == $action ) { |
55 | 55 | /* do something */ |
56 | | - } else if( 'failure' == $action ) { |
| 56 | + } elseif( 'failure' == $action ) { |
57 | 57 | $cSF->showForm( wfMsg('refreshspecial-fail') ); |
58 | | - } else if( $wgRequest->wasPosted() && 'submit' == $action && |
| 58 | + } elseif( $wgRequest->wasPosted() && 'submit' == $action && |
59 | 59 | $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
60 | 60 | $cSF->doSubmit(); |
61 | 61 | } else { |
Index: trunk/extensions/Push/specials/Push_Body.php |
— | — | @@ -3,32 +3,32 @@ |
4 | 4 | /** |
5 | 5 | * A special page that allows pushing one or more pages to one or more targets. |
6 | 6 | * Partly based on MediaWiki's Special:Export. |
7 | | - * |
| 7 | + * |
8 | 8 | * @since 0.1 |
9 | | - * |
| 9 | + * |
10 | 10 | * @file Push_Body.php |
11 | 11 | * @ingroup Push |
12 | | - * |
| 12 | + * |
13 | 13 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
14 | 14 | */ |
15 | 15 | class SpecialPush extends SpecialPage { |
16 | | - |
| 16 | + |
17 | 17 | /** |
18 | 18 | * Constructor. |
19 | | - * |
| 19 | + * |
20 | 20 | * @since 0.1 |
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | parent::__construct( 'Push', 'bulkpush' ); |
24 | 24 | } |
25 | | - |
| 25 | + |
26 | 26 | /** |
27 | 27 | * @see SpecialPage::getDescription |
28 | 28 | */ |
29 | 29 | public function getDescription() { |
30 | 30 | return wfMsg( 'special-' . strtolower( $this->mName ) ); |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | /** |
34 | 34 | * Sets headers - this should be called from the execute() method of all derived classes! |
35 | 35 | */ |
— | — | @@ -37,34 +37,34 @@ |
38 | 38 | $wgOut->setArticleRelated( false ); |
39 | 39 | $wgOut->setRobotPolicy( "noindex,nofollow" ); |
40 | 40 | $wgOut->setPageTitle( $this->getDescription() ); |
41 | | - } |
42 | | - |
| 41 | + } |
| 42 | + |
43 | 43 | /** |
44 | 44 | * Main method. |
45 | | - * |
46 | | - * @since 0.1 |
47 | | - * |
| 45 | + * |
| 46 | + * @since 0.1 |
| 47 | + * |
48 | 48 | * @param string $arg |
49 | 49 | */ |
50 | 50 | public function execute( $arg ) { |
51 | 51 | global $wgOut, $wgUser, $wgRequest, $egPushTargets; |
52 | | - |
| 52 | + |
53 | 53 | $this->setHeaders(); |
54 | 54 | $this->outputHeader(); |
55 | | - |
| 55 | + |
56 | 56 | // If the user is authorized, display the page, if not, show an error. |
57 | 57 | if ( !$this->userCanExecute( $wgUser ) ) { |
58 | 58 | $this->displayRestrictionError(); |
59 | 59 | return; |
60 | | - } |
61 | | - |
| 60 | + } |
| 61 | + |
62 | 62 | if ( count( $egPushTargets ) == 0 ) { |
63 | 63 | $wgOut->addHTML( '<p>' . htmlspecialchars( wfMsg( 'push-tab-no-targets' ) ) . '</p>' ); |
64 | 64 | return; |
65 | | - } |
| 65 | + } |
66 | 66 | |
67 | 67 | $doPush = false; |
68 | | - |
| 68 | + |
69 | 69 | if ( $wgRequest->getCheck( 'addcat' ) ) { |
70 | 70 | $pages = $wgRequest->getText( 'pages' ); |
71 | 71 | $catname = $wgRequest->getText( 'catname' ); |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | | - else if( $wgRequest->getCheck( 'addns' ) ) { |
| 86 | + elseif( $wgRequest->getCheck( 'addns' ) ) { |
87 | 87 | $pages = $wgRequest->getText( 'pages' ); |
88 | 88 | $nsindex = $wgRequest->getText( 'nsindex', '' ); |
89 | 89 | |
— | — | @@ -94,14 +94,14 @@ |
95 | 95 | if ( $nspages ) $pages .= "\n" . implode( "\n", $nspages ); |
96 | 96 | } |
97 | 97 | } |
98 | | - else if( $wgRequest->wasPosted() ) { |
| 98 | + elseif( $wgRequest->wasPosted() ) { |
99 | 99 | $pages = $wgRequest->getText( 'pages' ); |
100 | 100 | if( $pages != '' ) $doPush= true; |
101 | | - } |
| 101 | + } |
102 | 102 | else { |
103 | 103 | $pages = ''; |
104 | | - } |
105 | | - |
| 104 | + } |
| 105 | + |
106 | 106 | if ( $doPush ) { |
107 | 107 | $this->doPush( $pages ); |
108 | 108 | } |
— | — | @@ -109,18 +109,18 @@ |
110 | 110 | $this->displayPushInterface( $arg, $pages ); |
111 | 111 | } |
112 | 112 | } |
113 | | - |
| 113 | + |
114 | 114 | /** |
115 | 115 | * Outputs the HTML to indicate a push is occurring and |
116 | 116 | * the JavaScript to needed by the push. |
117 | | - * |
| 117 | + * |
118 | 118 | * @since 0.2 |
119 | | - * |
| 119 | + * |
120 | 120 | * @param string $pages |
121 | 121 | */ |
122 | 122 | protected function doPush( $pages ) { |
123 | 123 | global $wgOut, $wgLang, $wgRequest, $wgSitename, $wgTitle, $egPushTargets, $egPushBulkWorkers, $egPushBatchSize; |
124 | | - |
| 124 | + |
125 | 125 | $pageSet = array(); // Inverted index of all pages to look up |
126 | 126 | |
127 | 127 | // Split up and normalize input |
— | — | @@ -138,11 +138,11 @@ |
139 | 139 | $pageSet = PushFunctions::getTemplates( array_keys( $pageSet ), $pageSet ); |
140 | 140 | } |
141 | 141 | |
142 | | - $pages = array_keys( $pageSet ); |
143 | | - |
| 142 | + $pages = array_keys( $pageSet ); |
| 143 | + |
144 | 144 | $targets = array(); |
145 | 145 | $links = array(); |
146 | | - |
| 146 | + |
147 | 147 | if ( count( $egPushTargets ) > 1 ) { |
148 | 148 | foreach ( $egPushTargets as $targetName => $targetUrl ) { |
149 | 149 | if ( $wgRequest->getCheck( str_replace( ' ', '_', $targetName ) ) ) { |
— | — | @@ -154,9 +154,9 @@ |
155 | 155 | else { |
156 | 156 | $targets = $egPushTargets; |
157 | 157 | } |
158 | | - |
| 158 | + |
159 | 159 | $wgOut->addWikiMsg( 'push-special-pushing-desc', $wgLang->listToText( $links ), $wgLang->formatNum( count( $pages ) ) ); |
160 | | - |
| 160 | + |
161 | 161 | $wgOut->addHTML( |
162 | 162 | Html::hidden( 'siteName', $wgSitename, array( 'id' => 'siteName' ) ) . |
163 | 163 | Html::rawElement( |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | ) . '<br />' . |
175 | 175 | Html::element( 'a', array( 'href' => $wgTitle->getInternalURL() ), wfMsg( 'push-special-return' ) ) |
176 | 176 | ); |
177 | | - |
| 177 | + |
178 | 178 | $wgOut->addInlineScript( |
179 | 179 | 'var wgPushPages = ' . FormatJson::encode( $pages ) . ';' . |
180 | 180 | 'var wgPushTargets = ' . FormatJson::encode( $targets ) . ';' . |
— | — | @@ -181,16 +181,16 @@ |
182 | 182 | 'var wgPushBatchSize = ' . $egPushBatchSize . ';' . |
183 | 183 | 'var wgPushIncFiles = ' . ( $wgRequest->getCheck( 'files' ) ? 'true' : 'false' ) . ';' |
184 | 184 | ); |
185 | | - |
| 185 | + |
186 | 186 | $this->loadJs(); |
187 | 187 | } |
188 | | - |
| 188 | + |
189 | 189 | /** |
190 | 190 | * @since 0.2 |
191 | 191 | */ |
192 | 192 | protected function displayPushInterface( $arg, $pages ) { |
193 | 193 | global $wgOut, $wgUser, $wgRequest, $egPushTargets, $egPushIncTemplates, $egPushIncFiles; |
194 | | - |
| 194 | + |
195 | 195 | $wgOut->addWikiMsg( 'push-special-description' ); |
196 | 196 | |
197 | 197 | $form = Xml::openElement( 'form', array( 'method' => 'post', |
— | — | @@ -210,43 +210,43 @@ |
211 | 211 | 'wpPushTemplates', |
212 | 212 | $wgRequest->wasPosted() ? $wgRequest->getCheck( 'templates' ) : $egPushIncTemplates |
213 | 213 | ) . '<br />'; |
214 | | - |
| 214 | + |
215 | 215 | if ( $wgUser->isAllowed( 'filepush' ) ) { |
216 | 216 | $form .= Xml::checkLabel( |
217 | 217 | wfMsg( 'push-special-inc-files' ), |
218 | 218 | 'files', |
219 | 219 | 'wpPushFiles', |
220 | 220 | $wgRequest->wasPosted() ? $wgRequest->getCheck( 'files' ) : $egPushIncFiles |
221 | | - ) . '<br />'; |
| 221 | + ) . '<br />'; |
222 | 222 | } |
223 | | - |
| 223 | + |
224 | 224 | if ( count( $egPushTargets ) == 1 ) { |
225 | 225 | $names = array_keys( $egPushTargets ); |
226 | 226 | $form .= '<b>' . htmlspecialchars( wfMsgExt( 'push-special-target-is', 'parsemag', $names[0] ) ) . '</b><br />'; |
227 | 227 | } |
228 | 228 | else { |
229 | 229 | $form .= '<b>' . htmlspecialchars( wfMsg( 'push-special-select-targets' ) ) . '</b><br />'; |
230 | | - |
| 230 | + |
231 | 231 | foreach ( $egPushTargets as $targetName => $targetUrl ) { |
232 | 232 | $checkName = str_replace( ' ', '_', $targetName ); |
233 | 233 | $checked = $wgRequest->wasPosted() ? $wgRequest->getCheck( $checkName ) : true; |
234 | 234 | $form .= Xml::checkLabel( $targetName, $checkName, $targetName, $checked ) . '<br />'; |
235 | 235 | } |
236 | 236 | } |
237 | | - |
| 237 | + |
238 | 238 | $form .= Xml::submitButton( wfMsg( 'push-special-button-text' ), array( 'style' => 'width: 125px; height: 30px' ) ); |
239 | 239 | $form .= Xml::closeElement( 'form' ); |
240 | | - |
241 | | - $wgOut->addHTML( $form ); |
| 240 | + |
| 241 | + $wgOut->addHTML( $form ); |
242 | 242 | } |
243 | | - |
| 243 | + |
244 | 244 | /** |
245 | | - * Returns all pages for a category (up to 5000). |
246 | | - * |
| 245 | + * Returns all pages for a category (up to 5000). |
| 246 | + * |
247 | 247 | * @since 0.2 |
248 | | - * |
| 248 | + * |
249 | 249 | * @param Title $title |
250 | | - * |
| 250 | + * |
251 | 251 | * @return array |
252 | 252 | */ |
253 | 253 | protected function getPagesFromCategory( Title $title ) { |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | ); |
266 | 266 | |
267 | 267 | $pages = array(); |
268 | | - |
| 268 | + |
269 | 269 | foreach ( $res as $row ) { |
270 | 270 | $n = $row->page_title; |
271 | 271 | if ($row->page_namespace) { |
— | — | @@ -278,12 +278,12 @@ |
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | | - * Returns all pages for a namespace (up to 5000). |
283 | | - * |
| 282 | + * Returns all pages for a namespace (up to 5000). |
| 283 | + * |
284 | 284 | * @since 0.2 |
285 | | - * |
| 285 | + * |
286 | 286 | * @param integer $nsindex |
287 | | - * |
| 287 | + * |
288 | 288 | * @return array |
289 | 289 | */ |
290 | 290 | protected function getPagesFromNamespace( $nsindex ) { |
— | — | @@ -299,10 +299,10 @@ |
300 | 300 | ); |
301 | 301 | |
302 | 302 | $pages = array(); |
303 | | - |
| 303 | + |
304 | 304 | foreach ( $res as $row ) { |
305 | 305 | $n = $row->page_title; |
306 | | - |
| 306 | + |
307 | 307 | if ( $row->page_namespace ) { |
308 | 308 | $ns = $wgContLang->getNsText( $row->page_namespace ); |
309 | 309 | $n = $ns . ':' . $n; |
— | — | @@ -311,33 +311,33 @@ |
312 | 312 | $pages[] = $n; |
313 | 313 | } |
314 | 314 | return $pages; |
315 | | - } |
316 | | - |
| 315 | + } |
| 316 | + |
317 | 317 | /** |
318 | 318 | * Loads the needed JavaScript. |
319 | 319 | * Takes care of non-RL compatibility. |
320 | | - * |
| 320 | + * |
321 | 321 | * @since 0.2 |
322 | 322 | */ |
323 | 323 | protected static function loadJs() { |
324 | 324 | global $wgOut; |
325 | | - |
| 325 | + |
326 | 326 | // For backward compatibility with MW < 1.17. |
327 | 327 | if ( is_callable( array( $wgOut, 'addModules' ) ) ) { |
328 | 328 | $wgOut->addModules( 'ext.push.special' ); |
329 | 329 | } |
330 | 330 | else { |
331 | 331 | global $egPushScriptPath; |
332 | | - |
| 332 | + |
333 | 333 | PushFunctions::addJSLocalisation(); |
334 | | - |
| 334 | + |
335 | 335 | $wgOut->includeJQuery(); |
336 | | - |
| 336 | + |
337 | 337 | $wgOut->addHeadItem( |
338 | 338 | 'ext.push.special', |
339 | 339 | Html::linkedScript( $egPushScriptPath . '/specials/ext.push.special.js' ) |
340 | 340 | ); |
341 | | - } |
342 | | - } |
343 | | - |
| 341 | + } |
| 342 | + } |
| 343 | + |
344 | 344 | } |
\ No newline at end of file |
Index: trunk/extensions/Push/api/ApiPush.php |
— | — | @@ -11,93 +11,93 @@ |
12 | 12 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
13 | 13 | */ |
14 | 14 | class ApiPush extends ApiBase { |
15 | | - |
| 15 | + |
16 | 16 | protected $editResponses = array(); |
17 | | - |
| 17 | + |
18 | 18 | /** |
19 | 19 | * Associative array containing CookieJar objects (values) to be passed in |
20 | 20 | * order to authenticate to the targets (keys). |
21 | | - * |
| 21 | + * |
22 | 22 | * @since 0.4 |
23 | | - * |
| 23 | + * |
24 | 24 | * @var array |
25 | 25 | */ |
26 | 26 | protected $cookieJars = array(); |
27 | | - |
| 27 | + |
28 | 28 | public function __construct( $main, $action ) { |
29 | 29 | parent::__construct( $main, $action ); |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | public function execute() { |
33 | 33 | global $wgUser; |
34 | | - |
| 34 | + |
35 | 35 | if ( !$wgUser->isAllowed( 'push' ) || $wgUser->isBlocked() ) { |
36 | 36 | $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
37 | 37 | } |
38 | | - |
| 38 | + |
39 | 39 | global $egPushLoginUser, $egPushLoginPass, $egPushLoginUsers, $egPushLoginPasswords; |
40 | | - |
| 40 | + |
41 | 41 | $params = $this->extractRequestParams(); |
42 | | - |
| 42 | + |
43 | 43 | if ( !isset( $params['page'] ) ) { |
44 | 44 | $this->dieUsageMsg( array( 'missingparam', 'page' ) ); |
45 | 45 | } |
46 | | - |
| 46 | + |
47 | 47 | if ( !isset( $params['targets'] ) ) { |
48 | 48 | $this->dieUsageMsg( array( 'missingparam', 'targets' ) ); |
49 | | - } |
| 49 | + } |
50 | 50 | |
51 | 51 | PushFunctions::flipKeys( $egPushLoginUsers, 'users' ); |
52 | 52 | PushFunctions::flipKeys( $egPushLoginPasswords, 'passwds' ); |
53 | | - |
| 53 | + |
54 | 54 | foreach ( $params['targets'] as &$target ) { |
55 | 55 | $user = false; |
56 | 56 | $pass = false; |
57 | | - |
| 57 | + |
58 | 58 | if ( array_key_exists( $target, $egPushLoginUsers ) && array_key_exists( $target, $egPushLoginPasswords ) ) { |
59 | 59 | $user = $egPushLoginUsers[$target]; |
60 | 60 | $pass = $egPushLoginPasswords[$target]; |
61 | 61 | } |
62 | | - else if ( $egPushLoginUser != '' && $egPushLoginPass != '' ) { |
| 62 | + elseif ( $egPushLoginUser != '' && $egPushLoginPass != '' ) { |
63 | 63 | $user = $egPushLoginUser; |
64 | | - $pass = $egPushLoginPass; |
65 | | - } |
66 | | - |
| 64 | + $pass = $egPushLoginPass; |
| 65 | + } |
| 66 | + |
67 | 67 | if ( substr( $target, -1 ) !== '/' ) { |
68 | 68 | $target .= '/'; |
69 | 69 | } |
70 | | - |
| 70 | + |
71 | 71 | $target .= 'api.php'; |
72 | | - |
| 72 | + |
73 | 73 | if ( $user !== false ) { |
74 | 74 | $this->doLogin( $user, $pass, $target ); |
75 | 75 | } |
76 | 76 | } |
77 | | - |
| 77 | + |
78 | 78 | foreach ( $params['page'] as $page ) { |
79 | 79 | $title = Title::newFromText( $page ); |
80 | | - |
| 80 | + |
81 | 81 | $revision = $this->getPageRevision( $title ); |
82 | | - |
| 82 | + |
83 | 83 | if ( $revision !== false ) { |
84 | 84 | $this->doPush( $title, $revision, $params['targets'] ); |
85 | | - } |
| 85 | + } |
86 | 86 | } |
87 | | - |
| 87 | + |
88 | 88 | foreach ( $this->editResponses as $response ) { |
89 | 89 | $this->getResult()->addValue( |
90 | 90 | null, |
91 | 91 | null, |
92 | 92 | FormatJson::decode( $response ) |
93 | | - ); |
94 | | - } |
| 93 | + ); |
| 94 | + } |
95 | 95 | } |
96 | | - |
| 96 | + |
97 | 97 | /** |
98 | 98 | * Logs in into a target wiki using the provided username and password. |
99 | | - * |
| 99 | + * |
100 | 100 | * @since 0.4 |
101 | | - * |
| 101 | + * |
102 | 102 | * @param string $user |
103 | 103 | * @param string $password |
104 | 104 | * @param string $target |
— | — | @@ -112,14 +112,14 @@ |
113 | 113 | 'lgname' => $user, |
114 | 114 | 'lgpassword' => $password |
115 | 115 | ); |
116 | | - |
| 116 | + |
117 | 117 | //static $fail = 0;$fail++; |
118 | | - |
| 118 | + |
119 | 119 | if ( !is_null( $token ) ) { |
120 | 120 | $requestData['lgtoken'] = $token; |
121 | 121 | } |
122 | | - |
123 | | - $req = PushFunctions::getHttpRequest( $target, |
| 122 | + |
| 123 | + $req = PushFunctions::getHttpRequest( $target, |
124 | 124 | array( |
125 | 125 | 'postData' => $requestData, |
126 | 126 | 'method' => 'POST', |
— | — | @@ -130,21 +130,21 @@ |
131 | 131 | if ( !is_null( $cookieJar ) ) { |
132 | 132 | $req->setCookieJar( $cookieJar ); |
133 | 133 | } |
134 | | - |
| 134 | + |
135 | 135 | $status = $req->execute(); |
136 | 136 | |
137 | 137 | $attemtNr++; |
138 | | - |
| 138 | + |
139 | 139 | if ( $status->isOK() ) { |
140 | 140 | $response = FormatJson::decode( $req->getContent() ); |
141 | | - |
| 141 | + |
142 | 142 | if ( property_exists( $response, 'login' ) |
143 | 143 | && property_exists( $response->login, 'result' ) ) { |
144 | 144 | |
145 | 145 | if ( $response->login->result == 'NeedToken' && $attemtNr < 3 ) { |
146 | 146 | $this->doLogin( $user, $password, $target, $response->login->token, $req->getCookieJar(), $attemtNr ); |
147 | 147 | } |
148 | | - else if ( $response->login->result == 'Success' ) { |
| 148 | + elseif ( $response->login->result == 'Success' ) { |
149 | 149 | $this->cookieJars[$target] = $req->getCookieJar(); |
150 | 150 | } |
151 | 151 | else { |
— | — | @@ -153,25 +153,25 @@ |
154 | 154 | } |
155 | 155 | else { |
156 | 156 | $this->dieUsage( wfMsgExt( 'push-err-authentication', 'parsemag', $target, '' ), 'authentication-failed' ); |
157 | | - } |
158 | | - } |
| 157 | + } |
| 158 | + } |
159 | 159 | else { |
160 | 160 | $this->dieUsage( wfMsgExt( 'push-err-authentication', 'parsemag', $target, '' ), 'authentication-failed' ); |
161 | 161 | } |
162 | 162 | } |
163 | | - |
| 163 | + |
164 | 164 | /** |
165 | 165 | * Makes an internal request to the API to get the needed revision. |
166 | | - * |
| 166 | + * |
167 | 167 | * @since 0.3 |
168 | | - * |
| 168 | + * |
169 | 169 | * @param Title $title |
170 | | - * |
| 170 | + * |
171 | 171 | * @return array or false |
172 | 172 | */ |
173 | 173 | protected function getPageRevision( Title $title ) { |
174 | 174 | $revId = PushFunctions::getRevisionToPush( $title ); |
175 | | - |
| 175 | + |
176 | 176 | $requestData = array( |
177 | 177 | 'action' => 'query', |
178 | 178 | 'format' => 'json', |
— | — | @@ -179,25 +179,25 @@ |
180 | 180 | 'rvprop' => 'timestamp|user|comment|content', |
181 | 181 | 'titles' => $title->getFullText(), |
182 | 182 | 'rvstartid' => $revId, |
183 | | - 'rvendid' => $revId, |
| 183 | + 'rvendid' => $revId, |
184 | 184 | ); |
185 | | - |
| 185 | + |
186 | 186 | $api = new ApiMain( new FauxRequest( $requestData, true ), true ); |
187 | 187 | $api->execute(); |
188 | 188 | $response = $api->getResultData(); |
189 | | - |
| 189 | + |
190 | 190 | $revision = false; |
191 | | - |
| 191 | + |
192 | 192 | if ( $response !== false |
193 | 193 | && array_key_exists( 'query', $response ) |
194 | 194 | && array_key_exists( 'pages', $response['query'] ) |
195 | 195 | && count( $response['query']['pages'] ) > 0 ) { |
196 | | - |
| 196 | + |
197 | 197 | foreach ( $response['query']['pages'] as $key => $value ) { |
198 | 198 | $first = $key; |
199 | 199 | break; |
200 | 200 | } |
201 | | - |
| 201 | + |
202 | 202 | if ( array_key_exists( 'revisions', $response['query']['pages'][$first] ) |
203 | 203 | && count( $response['query']['pages'][$first]['revisions'] ) > 0 ) { |
204 | 204 | $revision = $response['query']['pages'][$first]['revisions'][0]; |
— | — | @@ -212,80 +212,80 @@ |
213 | 213 | |
214 | 214 | return $revision; |
215 | 215 | } |
216 | | - |
| 216 | + |
217 | 217 | /** |
218 | 218 | * Pushes the page content to the target wikis. |
219 | | - * |
| 219 | + * |
220 | 220 | * @since 0.3 |
221 | | - * |
| 221 | + * |
222 | 222 | * @param Title $title |
223 | 223 | * @param array $revision |
224 | 224 | * @param array $targets |
225 | | - */ |
| 225 | + */ |
226 | 226 | protected function doPush( Title $title, array $revision, array $targets ) { |
227 | | - foreach ( $targets as $target ) { |
| 227 | + foreach ( $targets as $target ) { |
228 | 228 | $token = $this->getEditToken( $title, $target ); |
229 | | - |
| 229 | + |
230 | 230 | if ( $token !== false ) { |
231 | 231 | $doPush = true; |
232 | | - |
| 232 | + |
233 | 233 | wfRunHooks( 'PushAPIBeforePush', array( &$title, &$revision, &$target, &$token, &$doPush ) ); |
234 | | - |
| 234 | + |
235 | 235 | if ( $doPush ) { |
236 | 236 | $this->pushToTarget( $title, $revision, $target, $token ); |
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
240 | 240 | } |
241 | | - |
| 241 | + |
242 | 242 | /** |
243 | 243 | * Obtains the needed edit token by making an HTTP GET request |
244 | | - * to the remote wikis API. |
245 | | - * |
| 244 | + * to the remote wikis API. |
| 245 | + * |
246 | 246 | * @since 0.3 |
247 | | - * |
| 247 | + * |
248 | 248 | * @param Title $title |
249 | 249 | * @param string $target |
250 | | - * |
| 250 | + * |
251 | 251 | * @return string or false |
252 | | - */ |
| 252 | + */ |
253 | 253 | protected function getEditToken( Title $title, $target ) { |
254 | 254 | $requestData = array( |
255 | 255 | 'action' => 'query', |
256 | 256 | 'format' => 'json', |
257 | 257 | 'intoken' => 'edit', |
258 | 258 | 'prop' => 'info', |
259 | | - 'titles' => $title->getFullText(), |
| 259 | + 'titles' => $title->getFullText(), |
260 | 260 | ); |
261 | | - |
| 261 | + |
262 | 262 | $parts = array(); |
263 | | - |
| 263 | + |
264 | 264 | foreach ( $requestData as $key => $value ) { |
265 | 265 | $parts[] = $key . '=' . urlencode( $value ); |
266 | 266 | } |
267 | 267 | |
268 | | - $req = PushFunctions::getHttpRequest( $target . '?' . implode( '&', $parts ), |
| 268 | + $req = PushFunctions::getHttpRequest( $target . '?' . implode( '&', $parts ), |
269 | 269 | array( |
270 | 270 | 'method' => 'GET', |
271 | 271 | 'timeout' => 'default' |
272 | 272 | ) |
273 | 273 | ); |
274 | | - |
| 274 | + |
275 | 275 | if ( array_key_exists( $target, $this->cookieJars ) ) { |
276 | 276 | $req->setCookieJar( $this->cookieJars[$target] ); |
277 | | - } |
278 | | - |
| 277 | + } |
| 278 | + |
279 | 279 | $status = $req->execute(); |
280 | | - |
| 280 | + |
281 | 281 | $response = $status->isOK() ? FormatJson::decode( $req->getContent() ) : null; |
282 | | - |
| 282 | + |
283 | 283 | $token = false; |
284 | 284 | |
285 | 285 | if ( !is_null( $response ) |
286 | 286 | && property_exists( $response, 'query' ) |
287 | 287 | && property_exists( $response->query, 'pages' ) |
288 | 288 | && count( $response->query->pages ) > 0 ) { |
289 | | - |
| 289 | + |
290 | 290 | foreach ( $response->query->pages as $key => $value ) { |
291 | 291 | $first = $key; |
292 | 292 | break; |
— | — | @@ -299,25 +299,25 @@ |
300 | 300 | } |
301 | 301 | else { |
302 | 302 | $this->dieUsage( wfMsg( 'push-special-err-token-failed' ), 'token-request-failed' ); |
303 | | - } |
| 303 | + } |
304 | 304 | } |
305 | 305 | else { |
306 | 306 | $this->dieUsage( wfMsg( 'push-special-err-token-failed' ), 'token-request-failed' ); |
307 | 307 | } |
308 | | - |
| 308 | + |
309 | 309 | return $token; |
310 | | - } |
311 | | - |
| 310 | + } |
| 311 | + |
312 | 312 | /** |
313 | 313 | * Pushes the page content to the specified wiki. |
314 | | - * |
| 314 | + * |
315 | 315 | * @since 0.3 |
316 | | - * |
| 316 | + * |
317 | 317 | * @param Title $title |
318 | 318 | * @param array $revision |
319 | 319 | * @param string $target |
320 | 320 | * @param string $token |
321 | | - */ |
| 321 | + */ |
322 | 322 | protected function pushToTarget( Title $title, array $revision, $target, $token ) { |
323 | 323 | global $wgSitename; |
324 | 324 | |
— | — | @@ -337,20 +337,20 @@ |
338 | 338 | 'token' => $token, |
339 | 339 | ); |
340 | 340 | |
341 | | - $req = PushFunctions::getHttpRequest( $target, |
| 341 | + $req = PushFunctions::getHttpRequest( $target, |
342 | 342 | array( |
343 | 343 | 'method' => 'POST', |
344 | 344 | 'timeout' => 'default', |
345 | 345 | 'postData' => $requestData |
346 | 346 | ) |
347 | 347 | ); |
348 | | - |
| 348 | + |
349 | 349 | if ( array_key_exists( $target, $this->cookieJars ) ) { |
350 | 350 | $req->setCookieJar( $this->cookieJars[$target] ); |
351 | 351 | } |
352 | | - |
| 352 | + |
353 | 353 | $status = $req->execute(); |
354 | | - |
| 354 | + |
355 | 355 | if ( $status->isOK() ) { |
356 | 356 | $this->editResponses[] = $req->getContent(); |
357 | 357 | } |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | $this->dieUsage( wfMsg( 'push-special-err-push-failed' ), 'page-push-failed' ); |
360 | 360 | } |
361 | 361 | } |
362 | | - |
| 362 | + |
363 | 363 | public function getAllowedParams() { |
364 | 364 | return array( |
365 | 365 | 'page' => array( |
— | — | @@ -370,23 +370,23 @@ |
371 | 371 | ApiBase::PARAM_TYPE => 'string', |
372 | 372 | ApiBase::PARAM_ISMULTI => true, |
373 | 373 | //ApiBase::PARAM_REQUIRED => true, |
374 | | - ), |
| 374 | + ), |
375 | 375 | ); |
376 | 376 | } |
377 | | - |
| 377 | + |
378 | 378 | public function getParamDescription() { |
379 | 379 | return array( |
380 | 380 | 'page' => 'The names of the page to push. Delimitered by |', |
381 | 381 | 'targets' => 'The urls of the wikis to push to. Delimitered by |', |
382 | 382 | ); |
383 | 383 | } |
384 | | - |
| 384 | + |
385 | 385 | public function getDescription() { |
386 | 386 | return array( |
387 | 387 | 'Pushes the content of one ore more pages to one or more target wikis.' |
388 | 388 | ); |
389 | 389 | } |
390 | | - |
| 390 | + |
391 | 391 | public function getPossibleErrors() { |
392 | 392 | return array_merge( parent::getPossibleErrors(), array( |
393 | 393 | array( 'missingparam', 'page' ), |
— | — | @@ -402,6 +402,6 @@ |
403 | 403 | |
404 | 404 | public function getVersion() { |
405 | 405 | return __CLASS__ . ': $Id$'; |
406 | | - } |
407 | | - |
| 406 | + } |
| 407 | + |
408 | 408 | } |
Index: trunk/extensions/Push/api/ApiPushImages.php |
— | — | @@ -11,67 +11,67 @@ |
12 | 12 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
13 | 13 | */ |
14 | 14 | class ApiPushImages extends ApiBase { |
15 | | - |
| 15 | + |
16 | 16 | /** |
17 | 17 | * Associative array containing CookieJar objects (values) to be passed in |
18 | 18 | * order to authenticate to the targets (keys). |
19 | | - * |
| 19 | + * |
20 | 20 | * @since 0.5 |
21 | | - * |
| 21 | + * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | 24 | protected $cookieJars = array(); |
25 | | - |
| 25 | + |
26 | 26 | public function __construct( $main, $action ) { |
27 | 27 | parent::__construct( $main, $action ); |
28 | 28 | } |
29 | | - |
| 29 | + |
30 | 30 | public function execute() { |
31 | 31 | global $wgUser; |
32 | | - |
| 32 | + |
33 | 33 | if ( !$wgUser->isAllowed( 'push' ) || $wgUser->isBlocked() ) { |
34 | 34 | $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
35 | 35 | } |
36 | | - |
| 36 | + |
37 | 37 | global $egPushLoginUser, $egPushLoginPass, $egPushLoginUsers, $egPushLoginPasswords; |
38 | | - |
| 38 | + |
39 | 39 | $params = $this->extractRequestParams(); |
40 | | - |
| 40 | + |
41 | 41 | if ( !isset( $params['images'] ) ) { |
42 | 42 | $this->dieUsageMsg( array( 'missingparam', 'images' ) ); |
43 | 43 | } |
44 | | - |
| 44 | + |
45 | 45 | if ( !isset( $params['targets'] ) ) { |
46 | 46 | $this->dieUsageMsg( array( 'missingparam', 'targets' ) ); |
47 | | - } |
| 47 | + } |
48 | 48 | |
49 | 49 | PushFunctions::flipKeys( $egPushLoginUsers, 'users' ); |
50 | | - PushFunctions::flipKeys( $egPushLoginPasswords, 'passwds' ); |
51 | | - |
| 50 | + PushFunctions::flipKeys( $egPushLoginPasswords, 'passwds' ); |
| 51 | + |
52 | 52 | foreach ( $params['targets'] as &$target ) { |
53 | 53 | $user = false; |
54 | 54 | $pass = false; |
55 | | - |
| 55 | + |
56 | 56 | if ( array_key_exists( $target, $egPushLoginUsers ) && array_key_exists( $target, $egPushLoginPasswords ) ) { |
57 | 57 | $user = $egPushLoginUsers[$target]; |
58 | 58 | $pass = $egPushLoginPasswords[$target]; |
59 | 59 | } |
60 | | - else if ( $egPushLoginUser != '' && $egPushLoginPass != '' ) { |
| 60 | + elseif ( $egPushLoginUser != '' && $egPushLoginPass != '' ) { |
61 | 61 | $user = $egPushLoginUser; |
62 | | - $pass = $egPushLoginPass; |
63 | | - } |
64 | | - |
| 62 | + $pass = $egPushLoginPass; |
| 63 | + } |
| 64 | + |
65 | 65 | if ( substr( $target, -1 ) !== '/' ) { |
66 | 66 | $target .= '/'; |
67 | 67 | } |
68 | | - |
| 68 | + |
69 | 69 | $target .= 'api.php'; |
70 | | - |
| 70 | + |
71 | 71 | if ( $user !== false ) { |
72 | 72 | $this->doLogin( $user, $pass, $target ); |
73 | 73 | } |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | foreach ( $params['images'] as $image ) { |
77 | 77 | $title = Title::newFromText( $image, NS_FILE ); |
78 | 78 | if ( !is_null( $title ) && $title->getNamespace() == NS_FILE && $title->exists() ) { |
— | — | @@ -79,12 +79,12 @@ |
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
83 | | - |
| 83 | + |
84 | 84 | /** |
85 | 85 | * Logs in into a target wiki using the provided username and password. |
86 | | - * |
| 86 | + * |
87 | 87 | * @since 0.5 |
88 | | - * |
| 88 | + * |
89 | 89 | * @param string $user |
90 | 90 | * @param string $password |
91 | 91 | * @param string $target |
— | — | @@ -99,37 +99,37 @@ |
100 | 100 | 'lgname' => $user, |
101 | 101 | 'lgpassword' => $password |
102 | 102 | ); |
103 | | - |
| 103 | + |
104 | 104 | if ( !is_null( $token ) ) { |
105 | 105 | $requestData['lgtoken'] = $token; |
106 | 106 | } |
107 | | - |
108 | | - $req = PushFunctions::getHttpRequest( $target, |
| 107 | + |
| 108 | + $req = PushFunctions::getHttpRequest( $target, |
109 | 109 | array( |
110 | 110 | 'postData' => $requestData, |
111 | 111 | 'method' => 'POST', |
112 | 112 | 'timeout' => 'default' |
113 | 113 | ) |
114 | 114 | ); |
115 | | - |
| 115 | + |
116 | 116 | if ( !is_null( $cookieJar ) ) { |
117 | 117 | $req->setCookieJar( $cookieJar ); |
118 | | - } |
119 | | - |
| 118 | + } |
| 119 | + |
120 | 120 | $status = $req->execute(); |
121 | 121 | |
122 | 122 | $attemtNr++; |
123 | | - |
| 123 | + |
124 | 124 | if ( $status->isOK() ) { |
125 | 125 | $response = FormatJson::decode( $req->getContent() ); |
126 | | - |
| 126 | + |
127 | 127 | if ( property_exists( $response, 'login' ) |
128 | 128 | && property_exists( $response->login, 'result' ) ) { |
129 | 129 | |
130 | 130 | if ( $response->login->result == 'NeedToken' && $attemtNr < 3 ) { |
131 | 131 | $this->doLogin( $user, $password, $target, $response->login->token, $req->getCookieJar(), $attemtNr ); |
132 | 132 | } |
133 | | - else if ( $response->login->result == 'Success' ) { |
| 133 | + elseif ( $response->login->result == 'Success' ) { |
134 | 134 | $this->cookieJars[$target] = $req->getCookieJar(); |
135 | 135 | } |
136 | 136 | else { |
— | — | @@ -138,85 +138,85 @@ |
139 | 139 | } |
140 | 140 | else { |
141 | 141 | $this->dieUsage( wfMsgExt( 'push-err-authentication', 'parsemag', $target, '' ), 'authentication-failed' ); |
142 | | - } |
143 | | - } |
| 142 | + } |
| 143 | + } |
144 | 144 | else { |
145 | 145 | $this->dieUsage( wfMsgExt( 'push-err-authentication', 'parsemag', $target, '' ), 'authentication-failed' ); |
146 | 146 | } |
147 | 147 | } |
148 | | - |
| 148 | + |
149 | 149 | /** |
150 | 150 | * Pushes the page content to the target wikis. |
151 | | - * |
| 151 | + * |
152 | 152 | * @since 0.5 |
153 | | - * |
| 153 | + * |
154 | 154 | * @param Title $title |
155 | 155 | * @param array $targets |
156 | | - */ |
| 156 | + */ |
157 | 157 | protected function doPush( Title $title, array $targets ) { |
158 | | - foreach ( $targets as $target ) { |
| 158 | + foreach ( $targets as $target ) { |
159 | 159 | $token = $this->getEditToken( $title, $target ); |
160 | 160 | |
161 | 161 | if ( $token !== false ) { |
162 | 162 | $doPush = true; |
163 | | - |
| 163 | + |
164 | 164 | wfRunHooks( 'PushAPIBeforeImagePush', array( &$title, &$target, &$token, &$doPush ) ); |
165 | | - |
| 165 | + |
166 | 166 | if ( $doPush ) { |
167 | 167 | $this->pushToTarget( $title, $target, $token ); |
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
171 | 171 | } |
172 | | - |
| 172 | + |
173 | 173 | /** |
174 | 174 | * Obtains the needed edit token by making an HTTP GET request |
175 | | - * to the remote wikis API. |
176 | | - * |
| 175 | + * to the remote wikis API. |
| 176 | + * |
177 | 177 | * @since 0.5 |
178 | | - * |
| 178 | + * |
179 | 179 | * @param Title $title |
180 | 180 | * @param string $target |
181 | | - * |
| 181 | + * |
182 | 182 | * @return string or false |
183 | | - */ |
| 183 | + */ |
184 | 184 | protected function getEditToken( Title $title, $target ) { |
185 | 185 | $requestData = array( |
186 | 186 | 'action' => 'query', |
187 | 187 | 'format' => 'json', |
188 | 188 | 'intoken' => 'edit', |
189 | 189 | 'prop' => 'info', |
190 | | - 'titles' => $title->getFullText(), |
| 190 | + 'titles' => $title->getFullText(), |
191 | 191 | ); |
192 | | - |
| 192 | + |
193 | 193 | $parts = array(); |
194 | | - |
| 194 | + |
195 | 195 | foreach ( $requestData as $key => $value ) { |
196 | 196 | $parts[] = $key . '=' . urlencode( $value ); |
197 | 197 | } |
198 | 198 | |
199 | | - $req = PushFunctions::getHttpRequest( $target . '?' . implode( '&', $parts ), |
| 199 | + $req = PushFunctions::getHttpRequest( $target . '?' . implode( '&', $parts ), |
200 | 200 | array( |
201 | 201 | 'method' => 'GET', |
202 | 202 | 'timeout' => 'default' |
203 | 203 | ) |
204 | 204 | ); |
205 | | - |
| 205 | + |
206 | 206 | if ( array_key_exists( $target, $this->cookieJars ) ) { |
207 | 207 | $req->setCookieJar( $this->cookieJars[$target] ); |
208 | | - } |
209 | | - |
| 208 | + } |
| 209 | + |
210 | 210 | $status = $req->execute(); |
211 | | - |
| 211 | + |
212 | 212 | $response = $status->isOK() ? FormatJson::decode( $req->getContent() ) : null; |
213 | | - |
| 213 | + |
214 | 214 | $token = false; |
215 | 215 | |
216 | 216 | if ( !is_null( $response ) |
217 | 217 | && property_exists( $response, 'query' ) |
218 | 218 | && property_exists( $response->query, 'pages' ) |
219 | 219 | && count( $response->query->pages ) > 0 ) { |
220 | | - |
| 220 | + |
221 | 221 | foreach ( $response->query->pages as $key => $value ) { |
222 | 222 | $first = $key; |
223 | 223 | break; |
— | — | @@ -230,27 +230,27 @@ |
231 | 231 | } |
232 | 232 | else { |
233 | 233 | $this->dieUsage( wfMsg( 'push-special-err-token-failed' ), 'token-request-failed' ); |
234 | | - } |
| 234 | + } |
235 | 235 | } |
236 | 236 | else { |
237 | 237 | $this->dieUsage( wfMsg( 'push-special-err-token-failed' ), 'token-request-failed' ); |
238 | 238 | } |
239 | | - |
| 239 | + |
240 | 240 | return $token; |
241 | | - } |
242 | | - |
| 241 | + } |
| 242 | + |
243 | 243 | /** |
244 | 244 | * Pushes the image to the specified wiki. |
245 | | - * |
| 245 | + * |
246 | 246 | * @since 0.5 |
247 | | - * |
| 247 | + * |
248 | 248 | * @param Title $title |
249 | 249 | * @param string $target |
250 | 250 | * @param string $token |
251 | | - */ |
| 251 | + */ |
252 | 252 | protected function pushToTarget( Title $title, $target, $token ) { |
253 | 253 | global $egPushDirectFileUploads; |
254 | | - |
| 254 | + |
255 | 255 | $imagePage = new ImagePage( $title ); |
256 | 256 | |
257 | 257 | $requestData = array( |
— | — | @@ -260,25 +260,25 @@ |
261 | 261 | 'filename' => $title->getText(), |
262 | 262 | 'ignorewarnings' => '1' |
263 | 263 | ); |
264 | | - |
| 264 | + |
265 | 265 | if ( $egPushDirectFileUploads ) { |
266 | 266 | $requestData['file'] = '@' . $imagePage->getFile()->getPath(); |
267 | 267 | } |
268 | 268 | else { |
269 | 269 | $requestData['url'] = $imagePage->getDisplayedFile()->getFullUrl(); |
270 | 270 | } |
271 | | - |
| 271 | + |
272 | 272 | $reqArgs = array( |
273 | 273 | 'method' => 'POST', |
274 | 274 | 'timeout' => 'default', |
275 | 275 | 'postData' => $requestData |
276 | 276 | ); |
277 | | - |
| 277 | + |
278 | 278 | if ( $egPushDirectFileUploads ) { |
279 | 279 | if ( !function_exists( 'curl_init' ) ) { |
280 | 280 | $this->dieUsage( wfMsg( 'push-api-err-nocurl' ), 'image-push-nocurl' ); |
281 | 281 | } |
282 | | - else if ( !defined( 'CurlHttpRequest::SUPPORTS_FILE_POSTS' ) || !CurlHttpRequest::SUPPORTS_FILE_POSTS ) { |
| 282 | + elseif ( !defined( 'CurlHttpRequest::SUPPORTS_FILE_POSTS' ) || !CurlHttpRequest::SUPPORTS_FILE_POSTS ) { |
283 | 283 | $this->dieUsage( wfMsg( 'push-api-err-nofilesupport' ), 'image-push-nofilesupport' ); |
284 | 284 | } |
285 | 285 | else { |
— | — | @@ -288,25 +288,25 @@ |
289 | 289 | else { |
290 | 290 | $req = PushFunctions::getHttpRequest( $target, $reqArgs ); |
291 | 291 | } |
292 | | - |
| 292 | + |
293 | 293 | if ( array_key_exists( $target, $this->cookieJars ) ) { |
294 | 294 | $req->setCookieJar( $this->cookieJars[$target] ); |
295 | | - } |
296 | | - |
| 295 | + } |
| 296 | + |
297 | 297 | $status = $req->execute(); |
298 | | - |
| 298 | + |
299 | 299 | if ( $status->isOK() ) { |
300 | 300 | $this->getResult()->addValue( |
301 | 301 | null, |
302 | 302 | null, |
303 | 303 | FormatJson::decode( $req->getContent() ) |
304 | | - ); |
| 304 | + ); |
305 | 305 | } |
306 | 306 | else { |
307 | 307 | $this->dieUsage( wfMsg( 'push-special-err-push-failed' ), 'page-push-failed' ); |
308 | 308 | } |
309 | 309 | } |
310 | | - |
| 310 | + |
311 | 311 | public function getAllowedParams() { |
312 | 312 | return array( |
313 | 313 | 'images' => array( |
— | — | @@ -318,23 +318,23 @@ |
319 | 319 | ApiBase::PARAM_TYPE => 'string', |
320 | 320 | ApiBase::PARAM_ISMULTI => true, |
321 | 321 | //ApiBase::PARAM_REQUIRED => true, |
322 | | - ), |
| 322 | + ), |
323 | 323 | ); |
324 | 324 | } |
325 | | - |
| 325 | + |
326 | 326 | public function getParamDescription() { |
327 | 327 | return array( |
328 | 328 | 'images' => 'The names of the images to push. Delimitered by |', |
329 | 329 | 'targets' => 'The urls of the wikis to push to. Delimitered by |', |
330 | 330 | ); |
331 | 331 | } |
332 | | - |
| 332 | + |
333 | 333 | public function getDescription() { |
334 | 334 | return array( |
335 | 335 | 'Pushes the content of one ore more pages to one or more target wikis.' |
336 | 336 | ); |
337 | 337 | } |
338 | | - |
| 338 | + |
339 | 339 | public function getPossibleErrors() { |
340 | 340 | return array_merge( parent::getPossibleErrors(), array( |
341 | 341 | array( 'missingparam', 'images' ), |
— | — | @@ -350,6 +350,6 @@ |
351 | 351 | |
352 | 352 | public function getVersion() { |
353 | 353 | return __CLASS__ . ': $Id$'; |
354 | | - } |
355 | | - |
| 354 | + } |
| 355 | + |
356 | 356 | } |
Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | * thumb.php is to be used (e.g. $wgThumbnailScriptPath !== false). You should |
201 | 201 | * pass through the same parameters as in makeParamString(). |
202 | 202 | */ |
203 | | - function getScriptParams( $params ) { |
| 203 | + function getScriptParams( $params ) { |
204 | 204 | return array( |
205 | 205 | 'width' => $params['width'], |
206 | 206 | 'page' => $params['page'], |
— | — | @@ -234,7 +234,7 @@ |
235 | 235 | $params['lossy'] = 'lossless'; |
236 | 236 | } else { |
237 | 237 | $params['lossy'] = 'lossy'; |
238 | | - } |
| 238 | + } |
239 | 239 | } |
240 | 240 | |
241 | 241 | return true; |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | |
249 | 249 | if ( !$metadata ) { |
250 | 250 | return true; |
251 | | - } else if ( isset( $metadata[ 'errors' ] ) ) { |
| 251 | + } elseif ( isset( $metadata[ 'errors' ] ) ) { |
252 | 252 | return $metadata[ 'errors' ]; |
253 | 253 | } else { |
254 | 254 | return false; |
— | — | @@ -262,12 +262,12 @@ |
263 | 263 | |
264 | 264 | $errors = array(); |
265 | 265 | foreach ( $errors_raw as $error ) { |
266 | | - if ( $error === false || $error === null || $error === 0 || $error === '' ) |
| 266 | + if ( $error === false || $error === null || $error === 0 || $error === '' ) |
267 | 267 | continue; |
268 | 268 | |
269 | 269 | $error = trim( $error ); |
270 | 270 | |
271 | | - if ( $error === '' ) |
| 271 | + if ( $error === '' ) |
272 | 272 | continue; |
273 | 273 | |
274 | 274 | if ( $to_html ) |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | * Supports extra parameters for multipage files and thumbnail type (lossless vs. lossy) |
294 | 294 | */ |
295 | 295 | function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) { |
296 | | - global $wgImageMagickConvertCommand, $wgMaxImageAreaForVips, |
| 296 | + global $wgImageMagickConvertCommand, $wgMaxImageAreaForVips, |
297 | 297 | $wgTiffUseVips, $wgTiffVipsCommand, $wgMaxImageArea; |
298 | 298 | |
299 | 299 | $meta = $this->getMetaArray( $image ); |
— | — | @@ -302,7 +302,7 @@ |
303 | 303 | $errors = PagedTiffHandler::joinMessages( $errors ); |
304 | 304 | if ( is_string( $errors ) ) { |
305 | 305 | // TODO: original error as param // TESTME |
306 | | - return $this->doThumbError( $params, 'tiff_bad_file' ); |
| 306 | + return $this->doThumbError( $params, 'tiff_bad_file' ); |
307 | 307 | } else { |
308 | 308 | return $this->doThumbError( $params, 'tiff_no_metadata' ); |
309 | 309 | } |
— | — | @@ -318,7 +318,7 @@ |
319 | 319 | $page = intval( $params['page'] ); |
320 | 320 | $page = $this->adjustPage( $image, $page ); |
321 | 321 | |
322 | | - if ( $flags & self::TRANSFORM_LATER ) { |
| 322 | + if ( $flags & self::TRANSFORM_LATER ) { |
323 | 323 | // pretend the thumbnail exists, let it be created by a 404-handler |
324 | 324 | return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page ); |
325 | 325 | } |
— | — | @@ -340,13 +340,13 @@ |
341 | 341 | if ( !$pagesize ) { |
342 | 342 | return $this->doThumbError( $params, 'tiff_no_metadata' ); |
343 | 343 | } |
344 | | - if ( isset( $meta['page_data'][$page]['pixels'] ) |
| 344 | + if ( isset( $meta['page_data'][$page]['pixels'] ) |
345 | 345 | && $meta['page_data'][$page]['pixels'] > $wgMaxImageAreaForVips ) |
346 | 346 | return $this->doThumbError( $params, 'tiff_sourcefile_too_large' ); |
347 | 347 | |
348 | 348 | if ( ( $width * $height ) > $wgMaxImageAreaForVips ) |
349 | | - return $this->doThumbError( $params, 'tiff_targetfile_too_large' ); |
350 | | - |
| 349 | + return $this->doThumbError( $params, 'tiff_targetfile_too_large' ); |
| 350 | + |
351 | 351 | // Shrink factors must be > 1. |
352 | 352 | if ( ( $pagesize['width'] > $width ) && ( $pagesize['height'] > $height ) ) { |
353 | 353 | $xfac = $pagesize['width'] / $width; |
— | — | @@ -366,7 +366,7 @@ |
367 | 367 | } else { |
368 | 368 | if ( ( $width * $height ) > $wgMaxImageArea ) |
369 | 369 | return $this->doThumbError( $params, 'tiff_targetfile_too_large' ); |
370 | | - if ( isset( $meta['page_data'][$page]['pixels'] ) |
| 370 | + if ( isset( $meta['page_data'][$page]['pixels'] ) |
371 | 371 | && $meta['page_data'][$page]['pixels'] > $wgMaxImageArea ) |
372 | 372 | return $this->doThumbError( $params, 'tiff_sourcefile_too_large' ); |
373 | 373 | $cmd = wfEscapeShellArg( $wgImageMagickConvertCommand ); |
— | — | @@ -405,7 +405,7 @@ |
406 | 406 | // We have some other file pretending to be a tiff image. |
407 | 407 | return $tiffImageThumbType; |
408 | 408 | } |
409 | | - |
| 409 | + |
410 | 410 | if ( $params[ 'lossy' ] == 'lossy' ) { |
411 | 411 | return array( 'jpg', 'image/jpeg' ); |
412 | 412 | } else { |
— | — | @@ -447,7 +447,7 @@ |
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
451 | | - * Returns a page number within range. |
| 451 | + * Returns a page number within range. |
452 | 452 | */ |
453 | 453 | function adjustPage( $image, $page ) { |
454 | 454 | $page = intval( $page ); |
— | — | @@ -473,7 +473,7 @@ |
474 | 474 | // no usable width/height in the parameter array |
475 | 475 | // only happens if we don't have image meta-data, and no |
476 | 476 | // size was specified by the user. |
477 | | - // we need to pick *some* size, and the preferred |
| 477 | + // we need to pick *some* size, and the preferred |
478 | 478 | // thumbnail size seems sane. |
479 | 479 | $sz = $wgUser->getOption( 'thumbsize' ); |
480 | 480 | $width = $wgThumbLimits[ $sz ]; |
— | — | @@ -488,7 +488,7 @@ |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | | - |
| 492 | + |
493 | 493 | return new MediaTransformError( 'thumbnail_error', |
494 | 494 | $width, $height, wfMsg( $msg ) ); |
495 | 495 | } |
— | — | @@ -522,7 +522,7 @@ |
523 | 523 | |
524 | 524 | $metadata = $this->getMetaArray( $image ); |
525 | 525 | if ( $metadata ) { |
526 | | - |
| 526 | + |
527 | 527 | return wfMsgExt( |
528 | 528 | 'tiff-file-info-size', |
529 | 529 | 'parseinline', |
— | — | @@ -656,7 +656,7 @@ |
657 | 657 | */ |
658 | 658 | static function getTiffImage( $image, $path ) { |
659 | 659 | // If no Image object is passed, a TiffImage is created based on $path . |
660 | | - // If there is an Image object, we check whether there's already a TiffImage |
| 660 | + // If there is an Image object, we check whether there's already a TiffImage |
661 | 661 | // instance in there; if not, a new instance is created and stored in the Image object |
662 | 662 | if ( !$image ) { |
663 | 663 | $tiffimg = new PagedTiffImage( $path ); |
— | — | @@ -700,8 +700,8 @@ |
701 | 701 | * Returns false if unknown or if the document is not multi-page. |
702 | 702 | */ |
703 | 703 | function getPageDimensions( $image, $page ) { |
704 | | - // makeImageLink2 (Linker.php) sets $page to false if no page parameter |
705 | | - // is set in wiki code |
| 704 | + // makeImageLink2 (Linker.php) sets $page to false if no page parameter |
| 705 | + // is set in wiki code |
706 | 706 | $page = $this->adjustPage( $image, $page ); |
707 | 707 | $data = $this->getMetaArray( $image ); |
708 | 708 | return PagedTiffImage::getPageSize( $data, $page ); |
Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler.image.php |
— | — | @@ -97,8 +97,8 @@ |
98 | 98 | //run hooks first, then optionally tiffinfo or, per default, ImageMagic's identify command |
99 | 99 | if ( !wfRunHooks( 'PagedTiffHandlerTiffData', array( $this->mFilename, &$this->_meta ) ) ) { |
100 | 100 | wfDebug( __METHOD__ . ": hook PagedTiffHandlerTiffData overrides TIFF data extraction\n" ); |
101 | | - } else if ( $wgTiffUseTiffinfo ) { |
102 | | - // read TIFF directories using libtiff's tiffinfo, see |
| 101 | + } elseif ( $wgTiffUseTiffinfo ) { |
| 102 | + // read TIFF directories using libtiff's tiffinfo, see |
103 | 103 | // http://www.libtiff.org/man/tiffinfo.1.html |
104 | 104 | $cmd = wfEscapeShellArg( $wgTiffTiffinfoCommand ) . |
105 | 105 | ' ' . wfEscapeShellArg( $this->mFilename ) . ' 2>&1'; |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | $this->_meta = $this->parseIdentifyOutput( $dump ); |
138 | | - } |
| 138 | + } |
139 | 139 | |
140 | 140 | $this->_meta['exif'] = array(); |
141 | 141 | |
— | — | @@ -142,13 +142,13 @@ |
143 | 143 | //run hooks first, then optionally Exiv2 or, per default, the internal EXIF class |
144 | 144 | if ( !empty( $this->_meta['errors'] ) ) { |
145 | 145 | wfDebug( __METHOD__ . ": found errors, skipping EXIF extraction\n" ); |
146 | | - } else if ( !wfRunHooks( 'PagedTiffHandlerExifData', array( $this->mFilename, &$this->_meta['exif'] ) ) ) { |
| 146 | + } elseif ( !wfRunHooks( 'PagedTiffHandlerExifData', array( $this->mFilename, &$this->_meta['exif'] ) ) ) { |
147 | 147 | wfDebug( __METHOD__ . ": hook PagedTiffHandlerExifData overrides EXIF extraction\n" ); |
148 | | - } else if ( $wgTiffUseExiv ) { |
149 | | - // read EXIF, XMP, IPTC as name-tag => interpreted data |
| 148 | + } elseif ( $wgTiffUseExiv ) { |
| 149 | + // read EXIF, XMP, IPTC as name-tag => interpreted data |
150 | 150 | // -ignore unknown fields |
151 | 151 | // see exiv2-doc @link http://www.exiv2.org/sample.html |
152 | | - // NOTE: the linux version of exiv2 has a bug: it can only |
| 152 | + // NOTE: the linux version of exiv2 has a bug: it can only |
153 | 153 | // read one type of meta-data at a time, not all at once. |
154 | 154 | $cmd = wfEscapeShellArg( $wgTiffExivCommand ) . |
155 | 155 | ' -u -psix -Pnt ' . wfEscapeShellArg( $this->mFilename ) . ' 2>&1'; |
— | — | @@ -168,14 +168,14 @@ |
169 | 169 | $data = $this->parseExiv2Output( $dump ); |
170 | 170 | |
171 | 171 | $this->_meta['exif'] = $data; |
172 | | - } else if ( $wgShowEXIF ) { |
| 172 | + } elseif ( $wgShowEXIF ) { |
173 | 173 | wfDebug( __METHOD__ . ": using internal Exif( {$this->mFilename} )\n" ); |
174 | 174 | $exif = new Exif( $this->mFilename ); |
175 | 175 | $data = $exif->getFilteredData(); |
176 | 176 | if ( $data ) { |
177 | 177 | $data['MEDIAWIKI_EXIF_VERSION'] = Exif::version(); |
178 | 178 | $this->_meta['exif'] = $data; |
179 | | - } |
| 179 | + } |
180 | 180 | } |
181 | 181 | |
182 | 182 | unset( $this->_meta['exif']['Image'] ); |
— | — | @@ -183,12 +183,12 @@ |
184 | 184 | unset( $this->_meta['exif']['Base filename'] ); |
185 | 185 | unset( $this->_meta['exif']['XMLPacket'] ); |
186 | 186 | unset( $this->_meta['exif']['ImageResources'] ); |
187 | | - |
| 187 | + |
188 | 188 | $this->_meta['TIFF_METADATA_VERSION'] = TIFF_METADATA_VERSION; |
189 | 189 | |
190 | 190 | wfProfileOut( 'PagedTiffImage::retrieveMetaData' ); |
191 | 191 | } |
192 | | - |
| 192 | + |
193 | 193 | return $this->_meta; |
194 | 194 | } |
195 | 195 | |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | $row = trim( $row ); |
213 | 213 | |
214 | 214 | # ignore XML rows |
215 | | - if ( preg_match('/^<|^$/', $row) ) { |
| 215 | + if ( preg_match('/^<|^$/', $row) ) { |
216 | 216 | continue; |
217 | 217 | } |
218 | 218 | |
— | — | @@ -247,10 +247,10 @@ |
248 | 248 | # check if the next IFD is to be ignored |
249 | 249 | $offset = (int)$m[1]; |
250 | 250 | $ignore = !empty( $ignoreIFDs[ $offset ] ); |
251 | | - } else if ( preg_match('#^(TIFF.*?Directory): (.*?/.*?): (.*)#i', $row, $m) ) { |
| 251 | + } elseif ( preg_match('#^(TIFF.*?Directory): (.*?/.*?): (.*)#i', $row, $m) ) { |
252 | 252 | # handle warnings |
253 | 253 | |
254 | | - $bypass = false; |
| 254 | + $bypass = false; |
255 | 255 | $msg = $m[3]; |
256 | 256 | |
257 | 257 | foreach ( $wgTiffTiffinfoBypassMessages as $pattern ) { |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | if ( !$bypass ) { |
265 | 265 | $state->addWarning( $msg ); |
266 | 266 | } |
267 | | - } else if ( preg_match('/^\s*(.*?)\s*:\s*(.*?)\s*$/', $row, $m) ) { |
| 267 | + } elseif ( preg_match('/^\s*(.*?)\s*:\s*(.*?)\s*$/', $row, $m) ) { |
268 | 268 | # handle key/value pair |
269 | 269 | |
270 | 270 | $key = $m[1]; |
— | — | @@ -271,15 +271,15 @@ |
272 | 272 | |
273 | 273 | if ( $key == 'Page Number' && preg_match('/(\d+)-(\d+)/', $value, $m) ) { |
274 | 274 | $state->setPageProperty('page', (int)$m[1] +1); |
275 | | - } else if ( $key == 'Samples/Pixel' ) { |
| 275 | + } elseif ( $key == 'Samples/Pixel' ) { |
276 | 276 | if ($value == '4') $state->setPageProperty('alpha', 'true'); |
277 | | - } else if ( $key == 'Extra samples' ) { |
| 277 | + } elseif ( $key == 'Extra samples' ) { |
278 | 278 | if (preg_match('.*alpha.*', $value)) $state->setPageProperty('alpha', 'true'); |
279 | | - } else if ( $key == 'Image Width' || $key == 'PixelXDimension' ) { |
| 279 | + } elseif ( $key == 'Image Width' || $key == 'PixelXDimension' ) { |
280 | 280 | $state->setPageProperty('width', (int)$value); |
281 | | - } else if ( $key == 'Image Length' || $key == 'PixelYDimension' ) { |
| 281 | + } elseif ( $key == 'Image Length' || $key == 'PixelYDimension' ) { |
282 | 282 | $state->setPageProperty('height', (int)$value); |
283 | | - } else if ( preg_match('/.*IFDOffset/', $key) ) { |
| 283 | + } elseif ( preg_match('/.*IFDOffset/', $key) ) { |
284 | 284 | # ignore extra IFDs, see <http://www.awaresystems.be/imaging/tiff/tifftags/exififd.html> |
285 | 285 | # Note: we assume that we will always see the reference before the actual IFD, so we know which IFDs to ignore |
286 | 286 | $offset = (int)$value; |
— | — | @@ -358,7 +358,7 @@ |
359 | 359 | $state->finishPage(); |
360 | 360 | } |
361 | 361 | |
362 | | - |
| 362 | + |
363 | 363 | $dump = preg_replace( '/\[BEGIN\](.+?)\[END\]/si', '', $dump ); |
364 | 364 | if ( strlen( $dump ) ) { |
365 | 365 | $errors = explode( "\n", $dump ); |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | if ( $this->prevPage >= $this->page['page'] ) { |
446 | 446 | $this->metadata['errors'][] = "inconsistent page numbering in TIFF directory"; |
447 | 447 | return false; |
448 | | - } |
| 448 | + } |
449 | 449 | } |
450 | 450 | |
451 | 451 | if ( isset( $this->page['width'] ) && isset( $this->page['height'] ) ) { |
Index: trunk/extensions/ReaderFeedback/phplot-5.0.5/phplot.php |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | var $y_precision = 1; |
70 | 70 | var $x_precision = 1; |
71 | 71 | |
72 | | - var $data_units_text = ''; // Units text for 'data' labels (i.e: '�', '$', etc.) |
| 72 | + var $data_units_text = ''; // Units text for 'data' labels (i.e: '�', '$', etc.) |
73 | 73 | |
74 | 74 | // Titles |
75 | 75 | var $title_txt = ''; |
— | — | @@ -581,7 +581,7 @@ |
582 | 582 | { |
583 | 583 | if (is_null($which_data) && is_array($this->data_colors)) { |
584 | 584 | // use already set data_colors |
585 | | - } else if (! is_array($which_data)) { |
| 585 | + } elseif (! is_array($which_data)) { |
586 | 586 | $this->data_colors = ($which_data) ? array($which_data) : array('blue', 'red', 'green', 'orange'); |
587 | 587 | } else { |
588 | 588 | $this->data_colors = $which_data; |
— | — | @@ -609,7 +609,7 @@ |
610 | 610 | { |
611 | 611 | if (is_null($which_br) && is_array($this->data_border_colors)) { |
612 | 612 | // use already set data_border_colors |
613 | | - } else if (! is_array($which_br)) { |
| 613 | + } elseif (! is_array($which_br)) { |
614 | 614 | // Create new array with specified color |
615 | 615 | $this->data_border_colors = ($which_br) ? array($which_br) : array('black'); |
616 | 616 | } else { |
— | — | @@ -635,7 +635,7 @@ |
636 | 636 | { |
637 | 637 | if (is_null($which_err) && is_array($this->error_bar_colors)) { |
638 | 638 | // use already set error_bar_colors |
639 | | - } else if (! is_array($which_err)) { |
| 639 | + } elseif (! is_array($which_err)) { |
640 | 640 | $this->error_bar_colors = ($which_err) ? array($which_err) : array('black'); |
641 | 641 | } else { |
642 | 642 | $this->error_bar_colors = $which_err; |
— | — | @@ -707,7 +707,7 @@ |
708 | 708 | { |
709 | 709 | if (is_null($which_lw)) { |
710 | 710 | // Do nothing, use default value. |
711 | | - } else if (is_array($which_lw)) { |
| 711 | + } elseif (is_array($which_lw)) { |
712 | 712 | // Did we get an array with line widths? |
713 | 713 | $this->line_widths = $which_lw; |
714 | 714 | } else { |
— | — | @@ -723,7 +723,7 @@ |
724 | 724 | { |
725 | 725 | if (is_null($which_ls)) { |
726 | 726 | // Do nothing, use default value. |
727 | | - } else if ( is_array($which_ls)) { |
| 727 | + } elseif ( is_array($which_ls)) { |
728 | 728 | // Did we get an array with line styles? |
729 | 729 | $this->line_styles = $which_ls; |
730 | 730 | } else { |
— | — | @@ -1493,7 +1493,7 @@ |
1494 | 1494 | * + Trigger a user-level error containing the error message. |
1495 | 1495 | * If no error handler was set up, the script will log the |
1496 | 1496 | * error and exit with non-zero status. |
1497 | | - * |
| 1497 | + * |
1498 | 1498 | * PrintError() and DrawError() are now equivalent. Both are provided for |
1499 | 1499 | * compatibility. (In earlier releases, PrintError sent the message to |
1500 | 1500 | * stdout only, and DrawError sent it in an image only.) |
— | — | @@ -1574,15 +1574,15 @@ |
1575 | 1575 | __FUNCTION__); |
1576 | 1576 | if (!$which_ydlp) return FALSE; |
1577 | 1577 | $this->y_data_label_pos = $which_ydlp; |
1578 | | - //This bit in SetYDataLabelPos about plotleft is for those who were |
| 1578 | + //This bit in SetYDataLabelPos about plotleft is for those who were |
1579 | 1579 | //using this function to set SetYTickLabelPos. |
1580 | | - if ( ($which_ydlp == 'plotleft') || ($which_ydlp == 'plotright') || |
1581 | | - ($which_ydlp == 'both') || ($which_ydlp == 'yaxis') ) { |
| 1580 | + if ( ($which_ydlp == 'plotleft') || ($which_ydlp == 'plotright') || |
| 1581 | + ($which_ydlp == 'both') || ($which_ydlp == 'yaxis') ) { |
1582 | 1582 | |
1583 | 1583 | //Call sety_TICK_labelpos instead of sety_DATA_labelpos |
1584 | 1584 | $this->SetYTickLabelPos($which_ydlp); |
1585 | 1585 | |
1586 | | - } elseif ($which_ydlp != 'none') { |
| 1586 | + } elseif ($which_ydlp != 'none') { |
1587 | 1587 | //right now its plotin or none |
1588 | 1588 | $this->y_data_label_pos = 'plotin'; |
1589 | 1589 | } |
— | — | @@ -1994,7 +1994,7 @@ |
1995 | 1995 | { |
1996 | 1996 | if (is_null($which_pt)) { |
1997 | 1997 | // Do nothing, use default value. |
1998 | | - } else if (is_array($which_pt)) { |
| 1998 | + } elseif (is_array($which_pt)) { |
1999 | 1999 | // Did we get an array with point shapes? |
2000 | 2000 | $this->point_shapes = $which_pt; |
2001 | 2001 | } else { |
— | — | @@ -2016,7 +2016,7 @@ |
2017 | 2017 | |
2018 | 2018 | if ($ps < $pt) { |
2019 | 2019 | $this->pad_array($this->point_sizes, $pt); |
2020 | | - } else if ($pt > $ps) { |
| 2020 | + } elseif ($pt > $ps) { |
2021 | 2021 | $this->pad_array($this->point_shapes, $ps); |
2022 | 2022 | } |
2023 | 2023 | return TRUE; |
— | — | @@ -2031,7 +2031,7 @@ |
2032 | 2032 | { |
2033 | 2033 | if (is_null($which_ps)) { |
2034 | 2034 | // Do nothing, use default value. |
2035 | | - } else if (is_array($which_ps)) { |
| 2035 | + } elseif (is_array($which_ps)) { |
2036 | 2036 | // Did we get an array with point sizes? |
2037 | 2037 | $this->point_sizes = $which_ps; |
2038 | 2038 | } else { |
— | — | @@ -2045,7 +2045,7 @@ |
2046 | 2046 | |
2047 | 2047 | if ($ps < $pt) { |
2048 | 2048 | $this->pad_array($this->point_sizes, $pt); |
2049 | | - } else if ($pt > $ps) { |
| 2049 | + } elseif ($pt > $ps) { |
2050 | 2050 | $this->pad_array($this->point_shapes, $ps); |
2051 | 2051 | } |
2052 | 2052 | |
— | — | @@ -2613,7 +2613,7 @@ |
2614 | 2614 | $this->x_left_margin = max($min_margin, $left_margin); |
2615 | 2615 | $this->x_right_margin = max($min_margin, $right_margin); |
2616 | 2616 | } |
2617 | | - |
| 2617 | + |
2618 | 2618 | if ($this->GetCallback('debug_scale')) { |
2619 | 2619 | // (Too bad compact() doesn't work on class member variables...) |
2620 | 2620 | $this->DoCallback('debug_scale', __FUNCTION__, array( |
— | — | @@ -2807,7 +2807,7 @@ |
2808 | 2808 | // Note that the extra space due to group_frac_width and bar_extra_space will be |
2809 | 2809 | // evenly divided on each side of the group: the drawn bars are centered in the group. |
2810 | 2810 | |
2811 | | - // Within each bar's allocated space, if bar_width_adjust=1 the bar fills the |
| 2811 | + // Within each bar's allocated space, if bar_width_adjust=1 the bar fills the |
2812 | 2812 | // space, otherwise it is centered. |
2813 | 2813 | // This is the actual drawn bar width: |
2814 | 2814 | $this->actual_bar_width = $this->record_bar_width * $this->bar_width_adjust; |
— | — | @@ -2846,7 +2846,7 @@ |
2847 | 2847 | $this->x_axis_position = 1; |
2848 | 2848 | elseif ($this->plot_min_y <= 0 && 0 <= $this->plot_max_y) |
2849 | 2849 | $this->x_axis_position = 0; |
2850 | | - else |
| 2850 | + else |
2851 | 2851 | $this->x_axis_position = $this->plot_min_y; |
2852 | 2852 | } else |
2853 | 2853 | $this->x_axis_position = min(max($this->plot_min_y, $this->x_axis_position), $this->plot_max_y); |
— | — | @@ -3293,10 +3293,10 @@ |
3294 | 3294 | if ($mode == 'scale') { |
3295 | 3295 | imagecopyresized($this->img, $im, $xorig, $yorig, 0, 0, $width, $height, $tile_width, $tile_height); |
3296 | 3296 | return TRUE; |
3297 | | - } else if ($mode == 'centeredtile') { |
| 3297 | + } elseif ($mode == 'centeredtile') { |
3298 | 3298 | $x0 = - floor($tile_width/2); // Make the tile look better |
3299 | 3299 | $y0 = - floor($tile_height/2); |
3300 | | - } else if ($mode == 'tile') { |
| 3300 | + } elseif ($mode == 'tile') { |
3301 | 3301 | $x0 = 0; |
3302 | 3302 | $y0 = 0; |
3303 | 3303 | } |
— | — | @@ -3676,17 +3676,17 @@ |
3677 | 3677 | * This is currently only used for Y data labels for bar charts. |
3678 | 3678 | */ |
3679 | 3679 | function DrawDataLabel($which_font, $which_angle, $x_world, $y_world, $which_color, $which_text, |
3680 | | - $which_halign = 'center', $which_valign = 'bottom', $x_adjustment=0, $y_adjustment=0) |
| 3680 | + $which_halign = 'center', $which_valign = 'bottom', $x_adjustment=0, $y_adjustment=0) |
3681 | 3681 | { |
3682 | 3682 | $data_label = $this->FormatLabel('y', $which_text); |
3683 | | - //since DrawDataLabel is going to be called alot - perhaps for speed it is better to |
| 3683 | + //since DrawDataLabel is going to be called alot - perhaps for speed it is better to |
3684 | 3684 | //not use this if statement and just always assume which_font is x_label_font (ditto for color). |
3685 | | - if ( empty($which_font) ) |
| 3685 | + if ( empty($which_font) ) |
3686 | 3686 | $which_font = $this->x_label_font; |
3687 | 3687 | |
3688 | 3688 | $which_angle = empty($which_angle)?'0':$this->x_label_angle; |
3689 | 3689 | |
3690 | | - if ( empty($which_color) ) |
| 3690 | + if ( empty($which_color) ) |
3691 | 3691 | $which_color = $this->ndx_title_color; |
3692 | 3692 | |
3693 | 3693 | $x_pixels = $this->xtr($x_world) + $x_adjustment; |
— | — | @@ -3755,12 +3755,12 @@ |
3756 | 3756 | ImageLine($this->img, $xpos, $this->plot_area[3], $xpos, $this->plot_area[1], $style); |
3757 | 3757 | } |
3758 | 3758 | // Lines from the bottom of the plot up to the max Y value at this X: |
3759 | | - else if ($this->x_data_label_pos == 'plotdown') { |
| 3759 | + elseif ($this->x_data_label_pos == 'plotdown') { |
3760 | 3760 | $ypos = $this->ytr($this->data_maxy[$row]); |
3761 | 3761 | ImageLine($this->img, $xpos, $ypos, $xpos, $this->plot_area[3], $style); |
3762 | 3762 | } |
3763 | 3763 | // Lines from the top of the plot down to the min Y value at this X: |
3764 | | - else if ($this->x_data_label_pos == 'plotup') { |
| 3764 | + elseif ($this->x_data_label_pos == 'plotup') { |
3765 | 3765 | $ypos = $this->ytr($this->data_miny[$row]); |
3766 | 3766 | ImageLine($this->img, $xpos, $this->plot_area[1], $xpos, $ypos, $style); |
3767 | 3767 | } |
— | — | @@ -3921,13 +3921,13 @@ |
3922 | 3922 | } |
3923 | 3923 | } |
3924 | 3924 | // Or only one column per row, one pie slice per row? |
3925 | | - else if ($this->data_type == 'text-data-single') { |
| 3925 | + elseif ($this->data_type == 'text-data-single') { |
3926 | 3926 | for ($i = 0; $i < $this->num_data_rows; $i++) { |
3927 | 3927 | $legend[$i] = $this->data[$i][0]; // Set the legend to column labels |
3928 | 3928 | $sumarr[$i] = $this->data[$i][1]; |
3929 | 3929 | } |
3930 | 3930 | } |
3931 | | - else if ($this->data_type == 'data-data') { |
| 3931 | + elseif ($this->data_type == 'data-data') { |
3932 | 3932 | for ($i = 0; $i < $this->num_data_rows; $i++) { |
3933 | 3933 | for ($j = 2; $j < $this->num_recs[$i]; $j++) { |
3934 | 3934 | @ $sumarr[$j] += abs($this->data[$i][$j]); |
— | — | @@ -4364,7 +4364,7 @@ |
4365 | 4365 | $start_lines[$idx] = TRUE; |
4366 | 4366 | } |
4367 | 4367 | // Y data missing... should we leave a blank or not? |
4368 | | - else if ($this->draw_broken_lines) { |
| 4368 | + elseif ($this->draw_broken_lines) { |
4369 | 4369 | $start_lines[$idx] = FALSE; |
4370 | 4370 | } |
4371 | 4371 | } // end for |
— | — | @@ -4498,7 +4498,7 @@ |
4499 | 4499 | $start_lines[$idx] = TRUE; |
4500 | 4500 | } |
4501 | 4501 | // Y data missing... should we leave a blank or not? |
4502 | | - else if ($this->draw_broken_lines) { |
| 4502 | + elseif ($this->draw_broken_lines) { |
4503 | 4503 | $start_lines[$idx] = FALSE; |
4504 | 4504 | } |
4505 | 4505 | } |
Index: trunk/extensions/regexBlock/regexBlockCore.php |
— | — | @@ -563,7 +563,7 @@ |
564 | 564 | if ( $valid['ip'] == 1 ) { |
565 | 565 | /* we blocked by IP */ |
566 | 566 | $user->mBlockreason = wfMsg( 'regexblock-reason-ip', $wgContactLink ); |
567 | | - } else if( $valid['exact'] == 1 ) { |
| 567 | + } elseif( $valid['exact'] == 1 ) { |
568 | 568 | /* we blocked by username exact match */ |
569 | 569 | $user->mBlockreason = wfMsg( 'regexblock-reason-name', $wgContactLink ); |
570 | 570 | } |