Skip to content

Commit 61d7377

Browse files
committed
PSR-12
1 parent 9577a5f commit 61d7377

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

lib/PowerIdPDisco.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __construct(array $metadataSets, $instance)
6363
$this->cdcDomain = $this->discoconfig->getString('cdc.domain', null);
6464
if ($this->cdcDomain !== null && $this->cdcDomain[0] !== '.') {
6565
// ensure that the CDC domain starts with a dot ('.') as required by the spec
66-
$this->cdcDomain = '.'.$this->cdcDomain;
66+
$this->cdcDomain = '.' . $this->cdcDomain;
6767
}
6868

6969
$this->cdcLifetime = $this->discoconfig->getInteger('cdc.lifetime', null);
@@ -80,7 +80,7 @@ public function __construct(array $metadataSets, $instance)
8080
*/
8181
protected function log($message)
8282
{
83-
Logger::info('PowerIdPDisco.'.$this->instance.': '.$message);
83+
Logger::info('PowerIdPDisco.' . $this->instance . ': '.$message);
8484
}
8585

8686

@@ -224,8 +224,9 @@ protected function filterList($list)
224224
}
225225

226226
$defaultrule = true;
227-
if (array_key_exists('entities.include', $spmd['discopower.filter']) ||
228-
array_key_exists('tags.include', $spmd['discopower.filter'])
227+
if (
228+
array_key_exists('entities.include', $spmd['discopower.filter'])
229+
|| array_key_exists('tags.include', $spmd['discopower.filter'])
229230
) {
230231
$defaultrule = false;
231232
}
@@ -289,10 +290,10 @@ public function handleRequest()
289290
$t->data['rememberenabled'] = $this->config->getBoolean('idpdisco.enableremember', false);
290291
$t->data['rememberchecked'] = $this->config->getBoolean('idpdisco.rememberchecked', false);
291292
foreach (array_keys($idpList) as $tab) {
292-
if ($translator->getTag('{discopower:tabs:'.$tab.'}') === null) {
293-
$translator->includeInlineTranslation('{discopower:tabs:'.$tab.'}', $tab);
293+
if ($translator->getTag('{discopower:tabs:' . $tab . '}') === null) {
294+
$translator->includeInlineTranslation('{discopower:tabs:' . $tab . '}', $tab);
294295
}
295-
$t->data['tabNames'][$tab] = $translator::noop('{discopower:tabs:'.$tab.'}');
296+
$t->data['tabNames'][$tab] = $translator::noop('{discopower:tabs:' . $tab . '}');
296297
}
297298
$t->show();
298299
}
@@ -307,9 +308,9 @@ public function handleRequest()
307308
private function processMetadata($t, $metadata, $favourite)
308309
{
309310
$basequerystring = '?'.
310-
'entityID='.urlencode($t->data['entityID']).'&'.
311-
'return='.urlencode($t->data['return']).'&'.
312-
'returnIDParam='.urlencode($t->data['returnIDParam']).'&idpentityid=';
311+
'entityID=' . urlencode($t->data['entityID']) . '&' .
312+
'return=' . urlencode($t->data['return']) . '&' .
313+
'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&idpentityid=';
313314

314315
foreach ($metadata as $tab => $idps) {
315316
foreach ($idps as $entityid => $entity) {
@@ -342,17 +343,17 @@ private function processMetadata($t, $metadata, $favourite)
342343

343344
// HTML output
344345
if ($entity['entityid'] === $favourite) {
345-
$html = '<a class="metaentry favourite" href="'.
346-
$basequerystring.urlencode($entity['entityid']).'">';
346+
$html = '<a class="metaentry favourite" href="' .
347+
$basequerystring.urlencode($entity['entityid']) . '">';
347348
} else {
348-
$html = '<a class="metaentry" href="'.
349-
$basequerystring.urlencode($entity['entityid']).'">';
349+
$html = '<a class="metaentry" href="' .
350+
$basequerystring.urlencode($entity['entityid']) . '">';
350351
}
351352
$html .= $entity['translated'];
352353
if (array_key_exists('icon', $entity) && $entity['icon'] !== null) {
353354
$iconUrl = HTTP::resolveURL($entity['icon']);
354-
$html .= '<img alt="Icon for identity provider" class="entryicon" src="'.
355-
htmlspecialchars($iconUrl).'" />';
355+
$html .= '<img alt="Icon for identity provider" class="entryicon" src="' .
356+
htmlspecialchars($iconUrl) . '" />';
356357
}
357358
$html .= '</a>';
358359
$entity['html'] = $html;

tests/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
$projectRoot = dirname(__DIR__);
4-
require_once($projectRoot.'/vendor/autoload.php');
4+
require_once($projectRoot . '/vendor/autoload.php');
55

66
// Symlink module into ssp vendor lib so that templates and urls can resolve correctly
7-
$linkPath = $projectRoot.'/vendor/simplesamlphp/simplesamlphp/modules/discopower';
7+
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/discopower';
88
if (file_exists($linkPath) === false) {
99
echo "Linking '$linkPath' to '$projectRoot'\n";
1010
symlink($projectRoot, $linkPath);

www/assets/js/quicksilver.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ String.prototype.score = function (abbreviation,offset) {
5757
continue;
5858
}
5959

60-
var next_string = this.substring(index+sub_abbreviation.length)
60+
var next_string = this.substring(index + sub_abbreviation.length)
6161
var next_abbreviation = null
6262

6363
if (i >= abbreviation.length) {
@@ -74,8 +74,8 @@ String.prototype.score = function (abbreviation,offset) {
7474
if (index != 0) {
7575
var j = 0;
7676
var c = this.charCodeAt(index - 1)
77-
if ( c==32 || c == 9) {
78-
for (j=(index-2); j >= 0; j--) {
77+
if ( c == 32 || c == 9) {
78+
for (j = (index - 2); j >= 0; j--) {
7979
c = this.charCodeAt(j)
8080
score -= ((c == 32 || c == 9) ? 1 : 0.15)
8181
}

www/assets/js/suggest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ String.prototype.score = function (abbreviation,offset) {
1111
for (var i = 0; i < suggest_cache['len']; ++i) {
1212
suggest_cache['re'][i] = new Array();
1313
// /\b<x>/ doesn't work when <x> i a non-ascii - oddly enough \s does ...
14-
suggest_cache['re'][i]['initialword'] = new RegExp("^"+words[i], "i");
15-
suggest_cache['re'][i]['word'] = new RegExp("[\\s-()_]"+words[i], "i");
14+
suggest_cache['re'][i]['initialword'] = new RegExp("^" + words[i], "i");
15+
suggest_cache['re'][i]['word'] = new RegExp("[\\s-()_]" + words[i], "i");
1616
}
1717
}
1818

www/assets/js/tablist.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
$(document).ready(function() {
1+
$(document).ready(function () {
22
$("#tabdiv").tabs();
33
$.getJSON("tablist.php", function(data) {
44
$("#tabdiv").select(data["default"]);
55
for (var i = 0; i < data["tabs"].length; i++) {
66
var tab = data["tabs"][i];
7-
$("#query_"+tab).liveUpdate("#list_"+tab);
7+
$("#query_" + tab).liveUpdate("#list_" + tab);
88
if (data["faventry"] === null && i === 0) {
9-
$("#query_"+tab).focus();
9+
$("#query_" + tab).focus();
1010
}
1111
}
1212
});

www/tablist.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
2+
23
/**
34
* An AJAX handler to retrieve a list of disco tabs from the session.
45
* This allows us to dynamically update the tab list without inline javascript.
56
*
67
* @author Guy Halse, http://orcid.org/0000-0002-9388-8592
78
* @package SimpleSAMLphp
89
*/
10+
911
$session = \SimpleSAML\Session::getSessionFromRequest();
1012
$tabs = $session->getData('discopower:tabList', 'tabs');
1113
$faventry = $session->getData('discopower:tabList', 'faventry');
@@ -18,11 +20,11 @@
1820
// handle JSON vs JSONP requests
1921
if (isset($_REQUEST['callback'])) {
2022
if (!preg_match('/^[a-z0-9_]+$/i', $_REQUEST['callback'], $matches)) {
21-
throw new \SimpleSAML\Error\Exception('Unsafe JSONP callback function name "'.$matches[0].'"');
23+
throw new \SimpleSAML\Error\Exception('Unsafe JSONP callback function name "' . $matches[0] . '"');
2224
}
2325
$jsonp = true;
2426
header('Content-Type: application/javascript');
25-
echo addslashes($matches[0]).'(';
27+
echo addslashes($matches[0]) . '(';
2628
} else {
2729
$jsonp = false;
2830
header('Content-Type: application/json');

0 commit comments

Comments
 (0)