Skip to content

Commit

Permalink
Conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Jun 7, 2013
1 parent c78c9f7 commit 4a6b790
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 37 deletions.
8 changes: 2 additions & 6 deletions classes/context/DefaultSettingDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function installDefaultBaseData($locale, $contextId, $skipLoad = true, $localeIn
* @param $contextId int
*/
function &getDefaultSettingIds($contextId) {
$result =& $this->retrieve(
$result = $this->retrieve(
'SELECT '. $this->getPrimaryKeyColumnName() .', '. $this->getDefaultKey() .' FROM '. $this->getTableName() .'
WHERE context_id = ? AND '. $this->getDefaultKey() .' IS NOT NULL', $contextId
);
Expand All @@ -188,8 +188,6 @@ function &getDefaultSettingIds($contextId) {
$result->MoveNext();
}
$result->Close();
unset($result);

return $returner;
}

Expand Down Expand Up @@ -224,7 +222,7 @@ function restoreByContextId($contextId, $locale = null) {
$sqlParams[] = $locale;
}

$result =& $this->retrieve($sql, $sqlParams);
$result = $this->retrieve($sql, $sqlParams);

$returner = null;
while (!$result->EOF) {
Expand All @@ -236,11 +234,9 @@ function restoreByContextId($contextId, $locale = null) {
(?, ?, ?, ?, ?)',
array($defaultIds[$row['entry_key']], $row['locale'], $row['setting_name'], $row['setting_value'], $row['setting_type'])
);
unset($row);
$result->MoveNext();
}
$result->Close();
unset($result);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions classes/context/FooterLinkDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ function getById($footerLinkId, $contextId = null) {
}

$result->Close();
unset($result);

return $returner;
}

Expand Down Expand Up @@ -243,8 +241,6 @@ function getLargestCategoryTotalByContextId($contextId) {
}

$result->Close();
unset($result);

return $returner;

}
Expand Down
2 changes: 0 additions & 2 deletions classes/context/PKPSocialMediaDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ function getById($socialMediaId, $contextId = null) {
}

$result->Close();
unset($result);

return $returner;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/db/DAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function &retrieveCached($sql, $params = false, $secsToCache = 3600, $callHooks

$start = Core::microtime();
$dataSource = $this->getDataSource();
$result =& $dataSource->CacheExecute($secsToCache, $sql, $params !== false && !is_array($params) ? array($params) : $params);
$result = $dataSource->CacheExecute($secsToCache, $sql, $params !== false && !is_array($params) ? array($params) : $params);
if ($dataSource->errorNo()) {
// FIXME Handle errors more elegantly.
fatalError('DB Error: ' . $dataSource->errorMsg());
Expand Down
4 changes: 2 additions & 2 deletions classes/mail/SubmissionMailTemplate.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function toAssignedSubEditors($submissionId, $stageId) {
* CC this email to all assigned sub editors in the given stage
* @param $submissionId int
* @param $stageId int
* @return array of Users (note, this differs from OxS which returns EditAssignment objects)
* @return array of Users
*/
function ccAssignedSubEditors($submissionId, $stageId) {
return $this->_addUsers($submissionId, ROLE_ID_SUB_EDITOR, $stageId, 'addCc');
Expand All @@ -188,7 +188,7 @@ function bccAssignedSubEditors($submissionId, $stageId) {
* @param $roleId int
* @param $stageId int
* @param $method string one of addRecipient, addCC, or addBCC
* @return array of Users (note, this differs from OxS which returns EditAssignment objects)
* @return array of Users
*/
protected function _addUsers($submissionId, $roleId, $stageId, $method) {
assert(in_array($method, array('addRecipient', 'addCc', 'addBcc')));
Expand Down
4 changes: 2 additions & 2 deletions classes/metadata/MetadataDescriptionDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function insertObject(&$metadataDescription) {
* @return MetadataDescription
*/
function &getObjectById($metadataDescriptionId) {
$result =& $this->retrieve(
$result = $this->retrieve(
'SELECT * FROM metadata_descriptions WHERE metadata_description_id = ?', $metadataDescriptionId
);

Expand All @@ -77,7 +77,7 @@ function &getObjectById($metadataDescriptionId) {
* @return DAOResultFactory containing matching source descriptions (MetadataDescription objects)
*/
function &getObjectsByAssocId($assocType, $assocId, $rangeInfo = null) {
$result =& $this->retrieveRange(
$result = $this->retrieveRange(
'SELECT *
FROM metadata_descriptions
WHERE assoc_type = ? AND assoc_id = ?
Expand Down
1 change: 0 additions & 1 deletion classes/stageAssignment/StageAssignmentDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ function build($submissionId, $userGroupId, $userId) {
if (!$stageAssignment->wasEmpty()) return $stageAssignment;

// Otherwise, build one.
unset($stageAssignment);
$stageAssignment = $this->newDataObject();
$stageAssignment->setSubmissionId($submissionId);
$stageAssignment->setUserGroupId($userGroupId);
Expand Down
8 changes: 4 additions & 4 deletions classes/submission/GenreDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function &getById($genreId, $contextId = null){
$sqlParams[] = (int)$contextId;
}

$result =& $this->retrieve('SELECT * FROM genres WHERE genre_id = ?'. ($contextId ? ' AND context_id = ?' : ''), $sqlParams);
$result = $this->retrieve('SELECT * FROM genres WHERE genre_id = ?'. ($contextId ? ' AND context_id = ?' : ''), $sqlParams);
$returner = null;
if ($result->RecordCount() != 0) {
$returner = $this->_fromRow($result->GetRowAssoc(false));
Expand All @@ -59,7 +59,7 @@ function &getById($genreId, $contextId = null){
* @return DAOResultFactory containing matching genres
*/
function &getEnabledByContextId($contextId, $rangeInfo = null) {
$result =& $this->retrieveRange(
$result = $this->retrieveRange(
'SELECT * FROM genres WHERE enabled = ? AND context_id = ?', array(1, $contextId), $rangeInfo
);

Expand All @@ -74,7 +74,7 @@ function &getEnabledByContextId($contextId, $rangeInfo = null) {
* @return DAOResultFactory containing matching genres
*/
function &getByContextId($contextId, $rangeInfo = null) {
$result =& $this->retrieveRange(
$result = $this->retrieveRange(
'SELECT * FROM genres WHERE context_id = ?', array($contextId), $rangeInfo
);

Expand Down Expand Up @@ -184,7 +184,7 @@ function deleteById($entryId) {
*/
function deleteByContextId($contextId) {

$result =& $this->getByContextId($contextId);
$result = $this->getByContextId($contextId);
while ($genre = $result->next()) {
$this->update('DELETE FROM genre_settings WHERE genre_id = ?', array((int) $genre->getId()));
}
Expand Down
6 changes: 0 additions & 6 deletions classes/submission/Submission.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
define('STATUS_PUBLISHED', 3);
define('STATUS_DECLINED', 4);

// getSubmissionStatus will return one of these in place of QUEUED:
define ('STATUS_QUEUED_UNASSIGNED', 5);
define ('STATUS_QUEUED_REVIEW', 6);
define ('STATUS_QUEUED_EDITING', 7);
define ('STATUS_INCOMPLETE', 8);

class Submission extends DataObject {
/**
* Constructor.
Expand Down
2 changes: 1 addition & 1 deletion classes/submission/action/EditorAction.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function addReviewer($request, $submission, $reviewerId, &$reviewRound, $reviewD
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao = DAORegistry::getDAO('UserDAO');

$reviewer =& $userDao->getById($reviewerId);
$reviewer = $userDao->getById($reviewerId);

// Check to see if the requested reviewer is not already
// assigned to review this submission.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,6 @@ function getAnonymousReviewerStatistics() {
}
$reviewerValues['lastMax'] = round($reviewerValues['lastMax'] / 86400); // Round to nearest day
$result->Close();
unset($result);

// Get number of currently active reviews
$result = $this->retrieve(
Expand All @@ -822,8 +821,6 @@ function getAnonymousReviewerStatistics() {
$result->MoveNext();
}
$result->Close();
unset($result);

return $reviewerValues;
}

Expand Down
5 changes: 3 additions & 2 deletions classes/submission/reviewRound/ReviewRoundDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ function build($submissionId, $stageId, $round, $status = null) {

// Otherwise, check the args to build one.
if ($stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ||
$stageId == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW &&
$round > 0) {
$stageId == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW &&
$round > 0
) {
unset($reviewRound);
$reviewRound = $this->newDataObject();
$reviewRound->setSubmissionId($submissionId);
Expand Down
1 change: 0 additions & 1 deletion classes/user/PKPUserDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ function getFilteredReviewers($contextId, $doneMin, $doneMax, $avgMin, $avgMax,
}
if ($key == 0) $allInterestIds = $interestIds; // First interest, nothing to intersect with
else $allInterestIds = array_intersect($allInterestIds, $interestIds);
unset($interest);
$key++;
}
}
Expand Down
5 changes: 3 additions & 2 deletions controllers/tab/settings/AdminSettingsTabHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ class AdminSettingsTabHandler extends SettingsTabHandler {

/**
* Constructor
* @param $additionalTabs array Optional additional ('tabname' => 'class/template name') mappings
*/
function AdminSettingsTabHandler() {
function AdminSettingsTabHandler($additionalTabs = array()) {
$role = array(ROLE_ID_SITE_ADMIN);

$this->addRoleAssignment(ROLE_ID_MANAGER,
Expand All @@ -34,7 +35,7 @@ function AdminSettingsTabHandler() {
);

parent::SettingsTabHandler($role);
$this->setPageTabs(array(
$this->setPageTabs($additionalTabs + array(
'siteSetup' => 'controllers.tab.admin.siteSetup.form.AppSiteSetupForm',
'languages' => 'controllers/tab/admin/languages/languages.tpl',
'plugins' => 'controllers/tab/admin/plugins/sitePlugins.tpl',
Expand Down

0 comments on commit 4a6b790

Please sign in to comment.