Skip to content

Commit

Permalink
Functions' variables casening
Browse files Browse the repository at this point in the history
  • Loading branch information
DaazKu committed Jul 21, 2017
1 parent 804d43f commit d6d6609
Show file tree
Hide file tree
Showing 234 changed files with 27,326 additions and 27,326 deletions.
Expand Up @@ -17,7 +17,7 @@ class ConversationsController extends Gdn_Controller {
*
* @return array
*/
public function getSettingsPages(&$Menu) {
public function getSettingsPages(&$menu) {
// There are no configuration pages for Conversations
}

Expand Down
304 changes: 152 additions & 152 deletions applications/conversations/controllers/class.messagescontroller.php

Large diffs are not rendered by default.

262 changes: 131 additions & 131 deletions applications/conversations/models/class.conversationmessagemodel.php

Large diffs are not rendered by default.

620 changes: 310 additions & 310 deletions applications/conversations/models/class.conversationmodel.php

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions applications/conversations/models/class.conversationsmodel.php
Expand Up @@ -26,8 +26,8 @@ abstract class ConversationsModel extends Gdn_Model {
* @since 2.2
* @access public
*/
public function __construct($Name = '') {
parent::__construct($Name);
public function __construct($name = '') {
parent::__construct($name);
$this->floodGate = FloodControlHelper::configure($this, 'Conversations', $this->Name);
}

Expand Down Expand Up @@ -61,37 +61,37 @@ public function checkForSpam($type, $skipSpamCheck = false) {
}

/**
* Get all the members of a conversation from the $ConversationID.
* Get all the members of a conversation from the $conversationID.
*
* @param int $ConversationID The conversation ID.
* @param int $conversationID The conversation ID.
*
* @return array Array of user IDs.
*/
public function getConversationMembers($ConversationID) {
$ConversationMembers = [];
public function getConversationMembers($conversationID) {
$conversationMembers = [];

$UserConversation = new Gdn_Model('UserConversation');
$UserMembers = $UserConversation->getWhere([
'ConversationID' => $ConversationID
$userConversation = new Gdn_Model('UserConversation');
$userMembers = $userConversation->getWhere([
'ConversationID' => $conversationID
])->resultArray();

if (is_array($UserMembers) && count($UserMembers)) {
$ConversationMembers = array_column($UserMembers, 'UserID');
if (is_array($userMembers) && count($userMembers)) {
$conversationMembers = array_column($userMembers, 'UserID');
}

return $ConversationMembers;
return $conversationMembers;
}

/**
* Check if user posting to the conversation is already a member.
*
* @param int $ConversationID The conversation ID.
* @param int $UserID The user id.
* @param int $conversationID The conversation ID.
* @param int $userID The user id.
*
* @return bool
*/
public function validConversationMember($ConversationID, $UserID) {
$ConversationMembers = $this->getConversationMembers($ConversationID);
return (in_array($UserID, $ConversationMembers));
public function validConversationMember($conversationID, $userID) {
$conversationMembers = $this->getConversationMembers($conversationID);
return (in_array($userID, $conversationMembers));
}
}
44 changes: 22 additions & 22 deletions applications/conversations/modules/class.addpeoplemodule.php
Expand Up @@ -24,16 +24,16 @@ class AddPeopleModule extends Gdn_Module {

/**
*
* @param Gdn_Controller $Sender
* @param Gdn_Controller $sender
* @throws Exception
*/
public function __construct($Sender = null) {
if (property_exists($Sender, 'Conversation')) {
$this->Conversation = $Sender->Conversation;
public function __construct($sender = null) {
if (property_exists($sender, 'Conversation')) {
$this->Conversation = $sender->Conversation;
}

// Allowed to use this module?
$this->AddUserAllowed = $Sender->ConversationModel->addUserAllowed($this->Conversation->ConversationID);
$this->AddUserAllowed = $sender->ConversationModel->addUserAllowed($this->Conversation->ConversationID);

$this->Form = Gdn::factory('Form', 'AddPeople');
// If the form was posted back, check for people to add to the conversation
Expand All @@ -43,23 +43,23 @@ public function __construct($Sender = null) {
throw permissionException();
}

$NewRecipientUserIDs = [];
$NewRecipients = explode(',', $this->Form->getFormValue('AddPeople', ''));
$UserModel = Gdn::factory("UserModel");
foreach ($NewRecipients as $Name) {
if (trim($Name) != '') {
$User = $UserModel->getByUsername(trim($Name));
if (is_object($User)) {
$NewRecipientUserIDs[] = $User->UserID;
$newRecipientUserIDs = [];
$newRecipients = explode(',', $this->Form->getFormValue('AddPeople', ''));
$userModel = Gdn::factory("UserModel");
foreach ($newRecipients as $name) {
if (trim($name) != '') {
$user = $userModel->getByUsername(trim($name));
if (is_object($user)) {
$newRecipientUserIDs[] = $user->UserID;
}
}
}

if ($Sender->ConversationModel->addUserToConversation($this->Conversation->ConversationID, $NewRecipientUserIDs)) {
$Sender->informMessage(t('Your changes were saved.'));
if ($sender->ConversationModel->addUserToConversation($this->Conversation->ConversationID, $newRecipientUserIDs)) {
$sender->informMessage(t('Your changes were saved.'));
} else {
$maxRecipients = ConversationModel::getMaxRecipients();
$Sender->informMessage(sprintf(
$sender->informMessage(sprintf(
plural(
$maxRecipients,
"You are limited to %s recipient.",
Expand All @@ -68,10 +68,10 @@ public function __construct($Sender = null) {
$maxRecipients
));
}
$Sender->setRedirectTo('/messages/'.$this->Conversation->ConversationID, false);
$sender->setRedirectTo('/messages/'.$this->Conversation->ConversationID, false);
}
$this->_ApplicationFolder = $Sender->Application;
$this->_ThemeFolder = $Sender->Theme;
$this->_ApplicationFolder = $sender->Application;
$this->_ThemeFolder = $sender->Theme;
}

/**
Expand All @@ -90,10 +90,10 @@ public function assetTarget() {
*/
public function toString() {
// Simplify our permission logic
$ConversationExists = (is_object($this->Conversation) && $this->Conversation->ConversationID > 0);
$CanAddUsers = ($this->AddUserAllowed && checkPermission('Conversations.Conversations.Add'));
$conversationExists = (is_object($this->Conversation) && $this->Conversation->ConversationID > 0);
$canAddUsers = ($this->AddUserAllowed && checkPermission('Conversations.Conversations.Add'));

if ($ConversationExists && $CanAddUsers) {
if ($conversationExists && $canAddUsers) {
return parent::toString();
}

Expand Down
Expand Up @@ -16,8 +16,8 @@ class ClearHistoryModule extends Gdn_Module {
/** @var int */
protected $ConversationID;

public function conversationID($ConversationID) {
$this->ConversationID = $ConversationID;
public function conversationID($conversationID) {
$this->ConversationID = $conversationID;
}

public function assetTarget() {
Expand Down
8 changes: 4 additions & 4 deletions applications/conversations/modules/class.inboxmodule.php
Expand Up @@ -27,12 +27,12 @@ public function __construct() {

public function getData() {
// Fetch from model.
$Model = new ConversationModel();
$Result = $Model->getInbox($this->UserID, $this->Limit, 0);
$model = new ConversationModel();
$result = $model->getInbox($this->UserID, $this->Limit, 0);

// Join in the participants.
$Model->joinParticipants($Result);
$this->setData('Conversations', $Result);
$model->joinParticipants($result);
$this->setData('Conversations', $result);
}

public function toString() {
Expand Down

0 comments on commit d6d6609

Please sign in to comment.