@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function findByPoll($pollId, $limit = null, $offset = null) { |
| 46 | 46 | $sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 47 | - return $this->findEntities($sql, [$pollId], $limit, $offset); |
|
| 47 | + return $this->findEntities($sql, [ $pollId ], $limit, $offset); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -52,6 +52,6 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function deleteByPoll($pollId) { |
| 54 | 54 | $sql = 'DELETE FROM ' . $this->getTableName() . ' WHERE poll_id = ?'; |
| 55 | - $this->execute($sql, [$pollId]); |
|
| 55 | + $this->execute($sql, [ $pollId ]); |
|
| 56 | 56 | } |
| 57 | 57 | } |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | \OCP\Util::addStyle('polls', 'list'); |
| 28 | 28 | \OCP\Util::addScript('polls', 'start'); |
| 29 | 29 | |
| 30 | - $userId = $_['userId']; |
|
| 31 | - $userMgr = $_['userMgr']; |
|
| 32 | - $urlGenerator = $_['urlGenerator']; |
|
| 30 | + $userId = $_[ 'userId' ]; |
|
| 31 | + $userMgr = $_[ 'userMgr' ]; |
|
| 32 | + $urlGenerator = $_[ 'urlGenerator' ]; |
|
| 33 | 33 | ?> |
| 34 | 34 | <div id="app-content"> |
| 35 | 35 | <div id="app-content-wrapper"> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | <input class="stop icon-close" style="display:none" value="" type="button"> |
| 49 | 49 | </div> |
| 50 | 50 | </div> |
| 51 | - <?php if (count($_['polls']) == 0) : ?> |
|
| 51 | + <?php if (count($_[ 'polls' ]) == 0) : ?> |
|
| 52 | 52 | <div id="emptycontent" class=""> |
| 53 | 53 | <div class="icon-polls"></div> |
| 54 | 54 | <h2><?php p($l->t('No existing polls.')); ?></h2> |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | </div> |
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | - <?php foreach ($_['polls'] as $poll) : ?> |
|
| 84 | + <?php foreach ($_[ 'polls' ] as $poll) : ?> |
|
| 85 | 85 | <?php |
| 86 | 86 | if (!userHasAccess($poll, $userId)) continue; |
| 87 | 87 | // direct url to poll |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $expiry_style = ''; |
| 92 | 92 | if ($poll->getType() == '0') { |
| 93 | - $participated = $_['participations']; |
|
| 93 | + $participated = $_[ 'participations' ]; |
|
| 94 | 94 | } else { |
| 95 | - $participated = $_['participations_text']; |
|
| 95 | + $participated = $_[ 'participations_text' ]; |
|
| 96 | 96 | } |
| 97 | 97 | $participated_class = 'partic_no'; |
| 98 | 98 | $participated_title = $l->t('You did not vote'); |
| 99 | 99 | $participated_count = count($participated); |
| 100 | 100 | |
| 101 | - $comments = $_['comments']; |
|
| 101 | + $comments = $_[ 'comments' ]; |
|
| 102 | 102 | $commented_class = 'commented_no'; |
| 103 | 103 | $commented_title = $l->t('You did not comment'); |
| 104 | 104 | $commented_count = count($comments); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | for ($i = 0; $i < count($participated); $i++) { |
| 124 | - if ($poll->getId() == intval($participated[$i]->getPollId())) { |
|
| 124 | + if ($poll->getId() == intval($participated[ $i ]->getPollId())) { |
|
| 125 | 125 | $participated_class = 'partic_yes'; |
| 126 | 126 | $participated_title = $l->t('You voted'); |
| 127 | 127 | array_splice($participated, $i, 1); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | for ($i = 0; $i < count($comments); $i++) { |
| 133 | - if ($poll->getId() == intval($comments[$i]->getPollId())) { |
|
| 133 | + if ($poll->getId() == intval($comments[ $i ]->getPollId())) { |
|
| 134 | 134 | $commented_class = 'commented_yes'; |
| 135 | 135 | $commented_title = $l->t('You commented'); |
| 136 | 136 | array_splice($comments, $i, 1); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | <div class="row table-body"> |
| 144 | 144 | <div class="wrapper group-master"> |
| 145 | 145 | <div class="wrapper group-1"> |
| 146 | - <div class="thumbnail <?php p($expiry_style . " " . $commented_class. " " . $participated_class); ?>"></div> <!-- Image to display status or type of poll */ --> |
|
| 146 | + <div class="thumbnail <?php p($expiry_style . " " . $commented_class . " " . $participated_class); ?>"></div> <!-- Image to display status or type of poll */ --> |
|
| 147 | 147 | <a href="<?php p($pollUrl); ?>" class="wrapper group-1-1"> |
| 148 | 148 | <div class="column name"> <?php p($poll->getTitle()); ?></div> |
| 149 | 149 | <div class="column description"> <?php p($poll->getDescription()); ?></div> |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | </button> |
| 167 | 167 | </li> |
| 168 | 168 | <li> |
| 169 | - <a href="<?php p($urlGenerator->linkToRoute('polls.page.edit_poll', ['hash' => $poll->getHash()])); ?>" class="menuitem action permanent" id="id_edit_<?php p($poll->getId()); ?>"> |
|
| 169 | + <a href="<?php p($urlGenerator->linkToRoute('polls.page.edit_poll', [ 'hash' => $poll->getHash() ])); ?>" class="menuitem action permanent" id="id_edit_<?php p($poll->getId()); ?>"> |
|
| 170 | 170 | <span class="icon-rename"></span> |
| 171 | 171 | <span>Edit Poll</span> |
| 172 | 172 | </a> |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | // Nextcloud >= 12 |
| 222 | 222 | $groups = \OC::$server->getGroupManager()->getUserGroups(\OC::$server->getUserSession()->getUser()); |
| 223 | - return array_map(function ($group) { |
|
| 223 | + return array_map(function($group) { |
|
| 224 | 224 | return $group->getGID(); |
| 225 | 225 | }, $groups); |
| 226 | 226 | } |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | define('PHPUNIT_RUN', 1); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -require_once(__DIR__.'/../../../lib/base.php'); |
|
| 29 | -require_once(__DIR__.'/../vendor/autoload.php'); |
|
| 28 | +require_once(__DIR__ . '/../../../lib/base.php'); |
|
| 29 | +require_once(__DIR__ . '/../vendor/autoload.php'); |
|
| 30 | 30 | |
| 31 | 31 | \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
| 32 | 32 | \OC_App::loadApp('polls'); |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | * @param $value |
| 35 | 35 | */ |
| 36 | 36 | public function __set($name, $value) { |
| 37 | - $this->setter($name, [$value]); |
|
| 37 | + $this->setter($name, [ $value ]); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | $fm->define('OCA\Polls\Db\Comment')->setDefinitions([ |
| 30 | 30 | 'userId' => Faker::firstNameMale(), |
| 31 | - 'dt' => function () { |
|
| 31 | + 'dt' => function() { |
|
| 32 | 32 | $date = new DateTime('today'); |
| 33 | 33 | return $date->format('Y-m-d H:i:s'); |
| 34 | 34 | }, |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | 'title' => Faker::sentence(10), |
| 32 | 32 | 'description' => Faker::paragraph(), |
| 33 | 33 | 'owner' => Faker::firstNameMale(), |
| 34 | - 'created' => function () { |
|
| 34 | + 'created' => function() { |
|
| 35 | 35 | $date = new DateTime('today'); |
| 36 | 36 | return $date->format('Y-m-d H:i:s'); |
| 37 | 37 | }, |
| 38 | 38 | 'access' => 'registered', |
| 39 | - 'expire' => function () { |
|
| 39 | + 'expire' => function() { |
|
| 40 | 40 | $date = new DateTime('tomorrow'); |
| 41 | 41 | return $date->format('Y-m-d H:i:s'); |
| 42 | 42 | }, |