Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 136754f

Browse files
author
Jamie Snape
committed
Consistently use else if instead of elseif
1 parent b8570e2 commit 136754f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+122
-122
lines changed

core/Bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function _initConfig()
109109
Zend_Db_Table::setDefaultAdapter($db);
110110
Zend_Registry::set('dbAdapter', $db);
111111
}
112-
elseif($configDatabase->database->type == 'mongo')
112+
else if($configDatabase->database->type == 'mongo')
113113
{
114114
// The mongo driver should be a php extension
115115
$db = new Mongo($configDatabase->database->params->host.":".
@@ -217,7 +217,7 @@ protected function _initRouter()
217217
$apiModules[] = $key;
218218
}
219219
}
220-
elseif($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
220+
else if($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
221221
{
222222
$listeModule[] = $key;
223223
// get WebApi controller directories and WebApi module names for enabled modules

core/ComponentLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function loadComponents($components, $module = '')
3333
{
3434
$this->loadComponent($components, $module);
3535
}
36-
elseif(is_array($components))
36+
else if(is_array($components))
3737
{
3838
foreach($components as $component)
3939
{
@@ -62,7 +62,7 @@ public function loadComponent($component, $module = '')
6262
{
6363
include_once BASE_PATH.'/modules/'.$module.'/controllers/components/'.$component.'Component.php';
6464
}
65-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
65+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
6666
{
6767
include_once BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php';
6868
}

core/GlobalController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function preDispatch()
6262
{
6363
$translaters[$module] = new Zend_Translate('csv', BASE_PATH.'/modules/'.$module.'/translation/fr-main.csv', 'en');
6464
}
65-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv'))
65+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv'))
6666
{
6767
$translaters[$module] = new Zend_Translate('csv', BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv', 'en');
6868
}
@@ -71,7 +71,7 @@ public function preDispatch()
7171
{
7272
$configs[$module] = new Zend_Config_Ini(BASE_PATH.'/core/configs/'.$module.'.local.ini', 'global');
7373
}
74-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini'))
74+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini'))
7575
{
7676
$configs[$module] = new Zend_Config_Ini(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini', 'global');
7777
}
@@ -101,7 +101,7 @@ public function preDispatch()
101101
$this->_forward($request->getActionName(), $request->getControllerName().'Core', $key, array('forwardModule' => true));
102102
}
103103
}
104-
elseif(file_exists(BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php'))
104+
else if(file_exists(BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php'))
105105
{
106106
include_once BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php';
107107
$name = ucfirst($key).'_'.ucfirst($request->getControllerName()).'CoreController';

core/MidasLoader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static function loadComponent($component, $module = '')
4545
{
4646
include_once BASE_PATH.'/modules/'.$module.'/controllers/components/'.$component.'Component.php';
4747
}
48-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
48+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
4949
{
5050
include_once BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php';
5151
}
@@ -96,7 +96,7 @@ public static function loadModel($model, $module = '')
9696
{
9797
include_once BASE_PATH.'/modules/'.$module.'/models/base/'.$model.'ModelBase.php';
9898
}
99-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php'))
99+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php'))
100100
{
101101
include_once BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php';
102102
}
@@ -105,7 +105,7 @@ public static function loadModel($model, $module = '')
105105
{
106106
include_once BASE_PATH.'/modules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php';
107107
}
108-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php'))
108+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php'))
109109
{
110110
include_once BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php';
111111
}
@@ -139,7 +139,7 @@ public static function loadModels($models, $module = '')
139139
{
140140
self::loadModel($models, $module);
141141
}
142-
elseif(is_array($models))
142+
else if(is_array($models))
143143
{
144144
foreach($models as $model)
145145
{
@@ -170,7 +170,7 @@ public static function newDao($name, $module = 'core')
170170
{
171171
require_once BASE_PATH.'/modules/'.$module.'/models/dao/'.$name.'.php';
172172
}
173-
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php'))
173+
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php'))
174174
{
175175
require_once BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php';
176176
}

core/controllers/AdminController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ function indexAction()
193193
copy($moduleConfigFile, $moduleConfigLocalFile);
194194
$this->Component->Utility->installModule($moduleName);
195195
}
196-
elseif(!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigPrivateFile))
196+
else if(!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigPrivateFile))
197197
{
198198
copy($moduleConfigPrivateFile, $moduleConfigLocalFile);
199199
$this->Component->Utility->installModule($moduleName);
200200
}
201-
elseif(!file_exists($moduleConfigLocalFile))
201+
else if(!file_exists($moduleConfigLocalFile))
202202
{
203203
throw new Zend_Exception("Unable to find config file");
204204
}
@@ -264,7 +264,7 @@ function indexAction()
264264
{
265265
$allModules[$key]->configPage = true;
266266
}
267-
elseif(file_exists(BASE_PATH."/privateModules/".$key."/controllers/ConfigController.php"))
267+
else if(file_exists(BASE_PATH."/privateModules/".$key."/controllers/ConfigController.php"))
268268
{
269269
$allModules[$key]->configPage = true;
270270
}
@@ -414,7 +414,7 @@ function showlogAction()
414414
{
415415
$shortMessage = substr($log->getMessage(), strpos($log->getMessage(), '[message]') + 13, 60);
416416
}
417-
elseif(substr($log->getMessage(), 0, 6) == 'Server')
417+
else if(substr($log->getMessage(), 0, 6) == 'Server')
418418
{
419419
$shortMessage = substr($log->getMessage(), strpos($log->getMessage(), 'Message:') + 9, 60);
420420
}

core/controllers/BrowseController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function movecopyAction()
137137
$this->Item->addReadonlyPolicy($item, $destinationFolder);
138138
}
139139
}
140-
elseif(isset($duplicateSubmit))
140+
else if(isset($duplicateSubmit))
141141
{
142142
if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_READ))
143143
{
@@ -228,7 +228,7 @@ public function movecopyAction()
228228
{
229229
$this->view->shareEnabled = true;
230230
}
231-
elseif(isset($duplicate))
231+
else if(isset($duplicate))
232232
{
233233
$this->view->duplicateEnabled = true;
234234
}

core/controllers/DownloadController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function indexAction()
160160
$this->Item->incrementDownloadCount($revision->getItem());
161161
$this->_downloadEmptyItem($revision->getItem());
162162
}
163-
elseif(count($bitstreams) == 1)
163+
else if(count($bitstreams) == 1)
164164
{
165165
if(preg_match('/^https?:\/\//', $bitstreams[0]->getPath()))
166166
{

core/controllers/FolderController.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ function editAction()
106106
{
107107
throw new Zend_Exception("Please set the folderId.");
108108
}
109-
elseif($folder === false)
109+
else if($folder === false)
110110
{
111111
throw new Zend_Exception("The folder doesn t exist.");
112112
}
113-
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
113+
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
114114
{
115115
throw new Zend_Exception("Permissions error.");
116116
}
@@ -164,11 +164,11 @@ public function viewAction()
164164
{
165165
throw new Zend_Exception('Please set the folderId.');
166166
}
167-
elseif($folder === false)
167+
else if($folder === false)
168168
{
169169
throw new Zend_Exception("The folder doesn't exist.", 404);
170170
}
171-
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ))
171+
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ))
172172
{
173173
throw new Zend_Exception('Invalid policy: no read access', 403);
174174
}
@@ -189,7 +189,7 @@ public function viewAction()
189189
{
190190
$breadcrumbs[] = array('type' => 'community', 'object' => $this->Folder->getCommunity($parent));
191191
}
192-
elseif(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
192+
else if(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
193193
{
194194
$breadcrumbs[] = array('type' => 'user', 'object' => $this->Folder->getUser($parent));
195195
}
@@ -245,7 +245,7 @@ public function deletedialogAction()
245245
{
246246
throw new Zend_Exception('Invalid folderId', 404);
247247
}
248-
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
248+
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
249249
{
250250
throw new Zend_Exception('Admin permission required', 403);
251251
}
@@ -265,11 +265,11 @@ public function deleteAction()
265265
{
266266
throw new Zend_Exception("Please set the folderId.");
267267
}
268-
elseif($folder === false)
268+
else if($folder === false)
269269
{
270270
throw new Zend_Exception("The folder doesn't exist.");
271271
}
272-
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
272+
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
273273
{
274274
throw new Zend_Exception("Permissions error.");
275275
}
@@ -316,19 +316,19 @@ public function removeitemAction()
316316
{
317317
throw new Zend_Exception("Please set the folderId.");
318318
}
319-
elseif($folder === false)
319+
else if($folder === false)
320320
{
321321
throw new Zend_Exception("The folder doesn't exist.");
322322
}
323-
elseif($item === false)
323+
else if($item === false)
324324
{
325325
throw new Zend_Exception("The item doesn't exist.");
326326
}
327-
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
327+
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
328328
{
329329
throw new Zend_Exception('Write permission on folder required');
330330
}
331-
elseif(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
331+
else if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
332332
{
333333
throw new Zend_Exception(MIDAS_ADMIN_PRIVILEGES_REQUIRED);
334334
}
@@ -352,7 +352,7 @@ public function createfolderAction()
352352
{
353353
throw new Zend_Exception("Please set the folderId.");
354354
}
355-
elseif($folder === false)
355+
else if($folder === false)
356356
{
357357
throw new Zend_Exception("The folder doesn't exist.");
358358
}

core/controllers/ItemController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function viewAction()
260260
{
261261
$currentFolder = $parents[0];
262262
}
263-
elseif(isset($this->userSession->recentFolders))
263+
else if(isset($this->userSession->recentFolders))
264264
{
265265
foreach($this->userSession->recentFolders as $recent)
266266
{
@@ -292,7 +292,7 @@ function viewAction()
292292
{
293293
$breadcrumbs[] = array('type' => 'community', 'object' => $this->Folder->getCommunity($parent));
294294
}
295-
elseif(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
295+
else if(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
296296
{
297297
$breadcrumbs[] = array('type' => 'user', 'object' => $this->Folder->getUser($parent));
298298
}
@@ -343,11 +343,11 @@ function editAction()
343343
{
344344
throw new Zend_Exception("Please set the itemId.");
345345
}
346-
elseif($item === false)
346+
else if($item === false)
347347
{
348348
throw new Zend_Exception("The item doesn t exist.");
349349
}
350-
elseif(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_WRITE))
350+
else if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_WRITE))
351351
{
352352
throw new Zend_Exception("Permissions error.");
353353
}

core/controllers/SearchController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function liveAction()
119119
// Search for the users
120120
$UsersDao = $this->User->getUsersFromSearch($search, $this->userSession->Dao);
121121
}
122-
elseif(isset($userSearch))
122+
else if(isset($userSearch))
123123
{
124124
$ItemsDao = array();
125125
$FoldersDao = array();
@@ -140,7 +140,7 @@ public function liveAction()
140140
}
141141
}
142142
}
143-
elseif(isset($itemSearch))
143+
else if(isset($itemSearch))
144144
{
145145
$ItemsDao = $this->Item->getItemsFromSearch($search, $this->userSession->Dao, 15, false);
146146
$FoldersDao = array();

0 commit comments

Comments
 (0)