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

Commit

Permalink
Consistently use else if instead of elseif
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Snape committed Jun 11, 2014
1 parent b8570e2 commit 136754f
Show file tree
Hide file tree
Showing 41 changed files with 122 additions and 122 deletions.
4 changes: 2 additions & 2 deletions core/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function _initConfig()
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('dbAdapter', $db);
}
elseif($configDatabase->database->type == 'mongo')
else if($configDatabase->database->type == 'mongo')
{
// The mongo driver should be a php extension
$db = new Mongo($configDatabase->database->params->host.":".
Expand Down Expand Up @@ -217,7 +217,7 @@ protected function _initRouter()
$apiModules[] = $key;
}
}
elseif($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
else if($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
{
$listeModule[] = $key;
// get WebApi controller directories and WebApi module names for enabled modules
Expand Down
4 changes: 2 additions & 2 deletions core/ComponentLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function loadComponents($components, $module = '')
{
$this->loadComponent($components, $module);
}
elseif(is_array($components))
else if(is_array($components))
{
foreach($components as $component)
{
Expand Down Expand Up @@ -62,7 +62,7 @@ public function loadComponent($component, $module = '')
{
include_once BASE_PATH.'/modules/'.$module.'/controllers/components/'.$component.'Component.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
{
include_once BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php';
}
Expand Down
6 changes: 3 additions & 3 deletions core/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function preDispatch()
{
$translaters[$module] = new Zend_Translate('csv', BASE_PATH.'/modules/'.$module.'/translation/fr-main.csv', 'en');
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv'))
{
$translaters[$module] = new Zend_Translate('csv', BASE_PATH.'/privateModules/'.$module.'/translation/fr-main.csv', 'en');
}
Expand All @@ -71,7 +71,7 @@ public function preDispatch()
{
$configs[$module] = new Zend_Config_Ini(BASE_PATH.'/core/configs/'.$module.'.local.ini', 'global');
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini'))
{
$configs[$module] = new Zend_Config_Ini(BASE_PATH.'/privateModules/'.$module.'/configs/module.ini', 'global');
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public function preDispatch()
$this->_forward($request->getActionName(), $request->getControllerName().'Core', $key, array('forwardModule' => true));
}
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php'))
{
include_once BASE_PATH.'/privateModules/'.$key.'/controllers/'. ucfirst($request->getControllerName()).'CoreController.php';
$name = ucfirst($key).'_'.ucfirst($request->getControllerName()).'CoreController';
Expand Down
10 changes: 5 additions & 5 deletions core/MidasLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function loadComponent($component, $module = '')
{
include_once BASE_PATH.'/modules/'.$module.'/controllers/components/'.$component.'Component.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
{
include_once BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php';
}
Expand Down Expand Up @@ -96,7 +96,7 @@ public static function loadModel($model, $module = '')
{
include_once BASE_PATH.'/modules/'.$module.'/models/base/'.$model.'ModelBase.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php'))
{
include_once BASE_PATH.'/privateModules/'.$module.'/models/base/'.$model.'ModelBase.php';
}
Expand All @@ -105,7 +105,7 @@ public static function loadModel($model, $module = '')
{
include_once BASE_PATH.'/modules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php'))
{
include_once BASE_PATH.'/privateModules/'.$module.'/models/'.$databaseType.'/'.$model.'Model.php';
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public static function loadModels($models, $module = '')
{
self::loadModel($models, $module);
}
elseif(is_array($models))
else if(is_array($models))
{
foreach($models as $model)
{
Expand Down Expand Up @@ -170,7 +170,7 @@ public static function newDao($name, $module = 'core')
{
require_once BASE_PATH.'/modules/'.$module.'/models/dao/'.$name.'.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php'))
{
require_once BASE_PATH.'/privateModules/'.$module.'/models/dao/'.$name.'.php';
}
Expand Down
8 changes: 4 additions & 4 deletions core/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ function indexAction()
copy($moduleConfigFile, $moduleConfigLocalFile);
$this->Component->Utility->installModule($moduleName);
}
elseif(!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigPrivateFile))
else if(!file_exists($moduleConfigLocalFile) && file_exists($moduleConfigPrivateFile))
{
copy($moduleConfigPrivateFile, $moduleConfigLocalFile);
$this->Component->Utility->installModule($moduleName);
}
elseif(!file_exists($moduleConfigLocalFile))
else if(!file_exists($moduleConfigLocalFile))
{
throw new Zend_Exception("Unable to find config file");
}
Expand Down Expand Up @@ -264,7 +264,7 @@ function indexAction()
{
$allModules[$key]->configPage = true;
}
elseif(file_exists(BASE_PATH."/privateModules/".$key."/controllers/ConfigController.php"))
else if(file_exists(BASE_PATH."/privateModules/".$key."/controllers/ConfigController.php"))
{
$allModules[$key]->configPage = true;
}
Expand Down Expand Up @@ -414,7 +414,7 @@ function showlogAction()
{
$shortMessage = substr($log->getMessage(), strpos($log->getMessage(), '[message]') + 13, 60);
}
elseif(substr($log->getMessage(), 0, 6) == 'Server')
else if(substr($log->getMessage(), 0, 6) == 'Server')
{
$shortMessage = substr($log->getMessage(), strpos($log->getMessage(), 'Message:') + 9, 60);
}
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/BrowseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function movecopyAction()
$this->Item->addReadonlyPolicy($item, $destinationFolder);
}
}
elseif(isset($duplicateSubmit))
else if(isset($duplicateSubmit))
{
if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_READ))
{
Expand Down Expand Up @@ -228,7 +228,7 @@ public function movecopyAction()
{
$this->view->shareEnabled = true;
}
elseif(isset($duplicate))
else if(isset($duplicate))
{
$this->view->duplicateEnabled = true;
}
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function indexAction()
$this->Item->incrementDownloadCount($revision->getItem());
$this->_downloadEmptyItem($revision->getItem());
}
elseif(count($bitstreams) == 1)
else if(count($bitstreams) == 1)
{
if(preg_match('/^https?:\/\//', $bitstreams[0]->getPath()))
{
Expand Down
26 changes: 13 additions & 13 deletions core/controllers/FolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ function editAction()
{
throw new Zend_Exception("Please set the folderId.");
}
elseif($folder === false)
else if($folder === false)
{
throw new Zend_Exception("The folder doesn t exist.");
}
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
{
throw new Zend_Exception("Permissions error.");
}
Expand Down Expand Up @@ -164,11 +164,11 @@ public function viewAction()
{
throw new Zend_Exception('Please set the folderId.');
}
elseif($folder === false)
else if($folder === false)
{
throw new Zend_Exception("The folder doesn't exist.", 404);
}
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ))
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ))
{
throw new Zend_Exception('Invalid policy: no read access', 403);
}
Expand All @@ -189,7 +189,7 @@ public function viewAction()
{
$breadcrumbs[] = array('type' => 'community', 'object' => $this->Folder->getCommunity($parent));
}
elseif(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
else if(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
{
$breadcrumbs[] = array('type' => 'user', 'object' => $this->Folder->getUser($parent));
}
Expand Down Expand Up @@ -245,7 +245,7 @@ public function deletedialogAction()
{
throw new Zend_Exception('Invalid folderId', 404);
}
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
{
throw new Zend_Exception('Admin permission required', 403);
}
Expand All @@ -265,11 +265,11 @@ public function deleteAction()
{
throw new Zend_Exception("Please set the folderId.");
}
elseif($folder === false)
else if($folder === false)
{
throw new Zend_Exception("The folder doesn't exist.");
}
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
{
throw new Zend_Exception("Permissions error.");
}
Expand Down Expand Up @@ -316,19 +316,19 @@ public function removeitemAction()
{
throw new Zend_Exception("Please set the folderId.");
}
elseif($folder === false)
else if($folder === false)
{
throw new Zend_Exception("The folder doesn't exist.");
}
elseif($item === false)
else if($item === false)
{
throw new Zend_Exception("The item doesn't exist.");
}
elseif(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
else if(!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_WRITE))
{
throw new Zend_Exception('Write permission on folder required');
}
elseif(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
else if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_ADMIN))
{
throw new Zend_Exception(MIDAS_ADMIN_PRIVILEGES_REQUIRED);
}
Expand All @@ -352,7 +352,7 @@ public function createfolderAction()
{
throw new Zend_Exception("Please set the folderId.");
}
elseif($folder === false)
else if($folder === false)
{
throw new Zend_Exception("The folder doesn't exist.");
}
Expand Down
8 changes: 4 additions & 4 deletions core/controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function viewAction()
{
$currentFolder = $parents[0];
}
elseif(isset($this->userSession->recentFolders))
else if(isset($this->userSession->recentFolders))
{
foreach($this->userSession->recentFolders as $recent)
{
Expand Down Expand Up @@ -292,7 +292,7 @@ function viewAction()
{
$breadcrumbs[] = array('type' => 'community', 'object' => $this->Folder->getCommunity($parent));
}
elseif(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
else if(strpos($parent->getName(), 'user') !== false && $this->Folder->getUser($parent) !== false)
{
$breadcrumbs[] = array('type' => 'user', 'object' => $this->Folder->getUser($parent));
}
Expand Down Expand Up @@ -343,11 +343,11 @@ function editAction()
{
throw new Zend_Exception("Please set the itemId.");
}
elseif($item === false)
else if($item === false)
{
throw new Zend_Exception("The item doesn t exist.");
}
elseif(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_WRITE))
else if(!$this->Item->policyCheck($item, $this->userSession->Dao, MIDAS_POLICY_WRITE))
{
throw new Zend_Exception("Permissions error.");
}
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function liveAction()
// Search for the users
$UsersDao = $this->User->getUsersFromSearch($search, $this->userSession->Dao);
}
elseif(isset($userSearch))
else if(isset($userSearch))
{
$ItemsDao = array();
$FoldersDao = array();
Expand All @@ -140,7 +140,7 @@ public function liveAction()
}
}
}
elseif(isset($itemSearch))
else if(isset($itemSearch))
{
$ItemsDao = $this->Item->getItemsFromSearch($search, $this->userSession->Dao, 15, false);
$FoldersDao = array();
Expand Down
6 changes: 3 additions & 3 deletions core/controllers/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function dialogAction()
{
$newPolicy = $this->Community->load($newPolicyId)->getMemberGroup();
}
elseif($newPolicyType == 'group')
else if($newPolicyType == 'group')
{
$newPolicy = $this->Group->load($newPolicyId);
}
Expand All @@ -197,7 +197,7 @@ function dialogAction()
{
$this->Folderpolicygroup->createPolicy($newPolicy, $element, MIDAS_POLICY_READ);
}
elseif($newPolicy instanceof UserDao)
else if($newPolicy instanceof UserDao)
{
$this->Folderpolicyuser->createPolicy($newPolicy, $element, MIDAS_POLICY_READ);
}
Expand All @@ -213,7 +213,7 @@ function dialogAction()
{
$this->Itempolicygroup->createPolicy($newPolicy, $element, MIDAS_POLICY_READ);
}
elseif($newPolicy instanceof UserDao)
else if($newPolicy instanceof UserDao)
{
$this->Itempolicyuser->createPolicy($newPolicy, $element, MIDAS_POLICY_READ);
}
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ public function userpageAction()
$this->_helper->viewRenderer->setNoRender();
return false;
}
elseif(!isset($user_id))
else if(!isset($user_id))
{
$userDao = $this->userSession->Dao;
$this->view->activemenu = 'myprofile'; // set the active menu
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public function manageAction()
$this->_helper->viewRenderer->setNoRender();
return false;
}
elseif(!isset($userId))
else if(!isset($userId))
{
$userDao = $this->userSession->Dao;
$this->view->activemenu = 'user'; // set the active menu
Expand Down
8 changes: 4 additions & 4 deletions core/controllers/components/ApidocsComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ public function getWebApiDocs($resource, $module = '')
$paramValue = trim(implode(' ', array_slice($splitParam, 2)));
$params[$paramName] = $paramValue;
}
elseif(strpos($doc, 'return') === 0)
else if(strpos($doc, 'return') === 0)
{
$return = trim(substr($doc, 6));
}
elseif(strpos($doc, 'path') === 0)
else if(strpos($doc, 'path') === 0)
{
$path = trim(substr($doc, 5));
}
elseif(strpos($doc, 'http') === 0)
else if(strpos($doc, 'http') === 0)
{
$http = trim(substr($doc, 5));
}
elseif(strpos($doc, 'idparam') === 0)
else if(strpos($doc, 'idparam') === 0)
{
$idParam = trim(substr($doc, 8));
}
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/components/DownloadBitstreamComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ function env($key)
{
$val = $_SERVER[$key];
}
elseif(isset($_ENV[$key]))
else if(isset($_ENV[$key]))
{
$val = $_ENV[$key];
}
elseif(getenv($key) !== false)
else if(getenv($key) !== false)
{
$val = getenv($key);
}
Expand Down
Loading

0 comments on commit 136754f

Please sign in to comment.