Skip to content

Commit c86067c

Browse files
committed
More syntax, string templates
1 parent 4c52f70 commit c86067c

File tree

10 files changed

+29
-32
lines changed

10 files changed

+29
-32
lines changed

app/Controllers/authController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ public function formLoginAction() {
160160
// All is good, go back to the index.
161161
Minz_Request::good(_t('feedback.auth.login.success'), [ 'c' => 'index', 'a' => 'index' ]);
162162
} else {
163-
Minz_Log::warning('Password mismatch for'
164-
. ' user=' . $username
165-
. ', nonce=' . $nonce
166-
. ', c=' . $challenge);
163+
Minz_Log::warning("Password mismatch for user={$username}, nonce={$nonce}, c={$challenge}");
167164

168165
header('HTTP/1.1 403 Forbidden');
169166
Minz_Session::_param('POST_to_GET', true); //Prevent infinite internal redirect

app/FreshRSS.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ private static function initAuth() {
7070
(Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'create' && !FreshRSS_Auth::hasAccess('admin')) ||
7171
(Minz_Request::controllerName() === 'feed' && Minz_Request::actionName() === 'actualize'
7272
&& FreshRSS_Context::$system_conf->allow_anonymous_refresh) ||
73-
(Minz_Request::controllerName() === 'javascript' && Minz_Request::actionName() === 'actualize' && FreshRSS_Context::$system_conf->allow_anonymous)
73+
(Minz_Request::controllerName() === 'javascript' && Minz_Request::actionName() === 'actualize'
74+
&& FreshRSS_Context::$system_conf->allow_anonymous)
7475
)) {
7576
// Token-based protection against XSRF attacks, except for the login or self-create user forms
7677
self::initI18n();

app/Models/DatabaseDAOPGSQL.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ public function size($all = false) {
5757
$stm->bindParam(':base', $db['base']);
5858
$stm->execute();
5959
} else {
60-
$sql = "SELECT "
61-
. "pg_total_relation_size('`{$this->pdo->prefix()}category`') + "
62-
. "pg_total_relation_size('`{$this->pdo->prefix()}feed`') + "
63-
. "pg_total_relation_size('`{$this->pdo->prefix()}entry`') + "
64-
. "pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') + "
65-
. "pg_total_relation_size('`{$this->pdo->prefix()}tag`') + "
66-
. "pg_total_relation_size('`{$this->pdo->prefix()}entrytag`')";
60+
$sql = <<<SQL
61+
SELECT
62+
pg_total_relation_size('`{$this->pdo->prefix()}category`')
63+
pg_total_relation_size('`{$this->pdo->prefix()}feed`')
64+
pg_total_relation_size('`{$this->pdo->prefix()}entry`')
65+
pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`')
66+
pg_total_relation_size('`{$this->pdo->prefix()}tag`')
67+
pg_total_relation_size('`{$this->pdo->prefix()}entrytag`')
68+
SQL;
6769
$stm = $this->pdo->query($sql);
6870
}
6971
if ($stm == false) {

app/Models/FormAuth.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ public static function checkCredentials($username, $hash, $nonce, $challenge) {
66
!ctype_graph($hash) ||
77
!ctype_graph($challenge) ||
88
!ctype_alnum($nonce)) {
9-
Minz_Log::debug('Invalid credential parameters:' .
10-
' user=' . $username .
11-
' challenge=' . $challenge .
12-
' nonce=' . $nonce);
9+
Minz_Log::debug("Invalid credential parameters: user={$username}, challenge={$challenge}, nonce={$nonce}");
1310
return false;
1411
}
1512

app/install.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,19 +456,19 @@ function printStep2() {
456456
<select name="type" id="type" tabindex="1">
457457
<?php if (extension_loaded('pdo_sqlite')) {?>
458458
<option value="sqlite"
459-
<?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>>
459+
<?= isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite' ? 'selected="selected"' : '' ?>>
460460
SQLite
461461
</option>
462462
<?php }?>
463463
<?php if (extension_loaded('pdo_mysql')) {?>
464464
<option value="mysql"
465-
<?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>>
465+
<?= isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql' ? 'selected="selected"' : '' ?>>
466466
MySQL
467467
</option>
468468
<?php }?>
469469
<?php if (extension_loaded('pdo_pgsql')) {?>
470470
<option value="pgsql"
471-
<?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'pgsql') ? 'selected="selected"' : ''; ?>>
471+
<?= isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'pgsql' ? 'selected="selected"' : '' ?>>
472472
PostgreSQL
473473
</option>
474474
<?php }?>

app/layout/aside_configure.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<li class="item<?= Minz_Request::actionName() === 'queries' ? ' active' : '' ?>">
1919
<a href="<?= _url('configure', 'queries') ?>"><?= _t('gen.menu.queries') ?></a>
2020
</li>
21-
<li class="item<?php echo Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'profile' ? ' active' : ''; ?>">
21+
<li class="item<?= Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'profile' ? ' active' : '' ?>">
2222
<a href="<?= _url('user', 'profile') ?>"><?= _t('gen.menu.user_profile') ?></a>
2323
</li>
2424
<li class="item<?= Minz_Request::controllerName() === 'extension' ? ' active' : '' ?>">
@@ -31,17 +31,17 @@
3131
<li class="item<?= Minz_Request::actionName() === 'system' ? ' active' : '' ?>">
3232
<a href="<?= _url('configure', 'system') ?>"><?= _t('gen.menu.system') ?></a>
3333
</li>
34-
<li class="item<?php echo Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'manage' ? ' active' : ''; ?>">
34+
<li class="item<?= Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'manage' ? ' active' : '' ?>">
3535
<a href="<?= _url('user', 'manage') ?>"><?= _t('gen.menu.user_management') ?></a>
3636
</li>
3737
<li class="item<?= Minz_Request::controllerName() === 'auth' ? ' active' : '' ?>">
3838
<a href="<?= _url('auth', 'index') ?>"><?= _t('gen.menu.authentication') ?></a>
3939
</li>
40-
<li class="item<?php echo Minz_Request::controllerName() === 'update' && Minz_Request::actionName() === 'checkInstall' ? ' active' : ''; ?>">
40+
<li class="item<?= Minz_Request::controllerName() === 'update' && Minz_Request::actionName() === 'checkInstall' ? ' active' : '' ?>">
4141
<a href="<?= _url('update', 'checkInstall') ?>"><?= _t('gen.menu.check_install') ?></a>
4242
</li>
4343
<?php if (!Minz_Configuration::get('system')->disable_update) { ?>
44-
<li class="item<?php echo Minz_Request::controllerName() === 'update' && Minz_Request::actionName() === 'index' ? ' active' : ''; ?>">
44+
<li class="item<?= Minz_Request::controllerName() === 'update' && Minz_Request::actionName() === 'index' ? ' active' : '' ?>">
4545
<a href="<?= _url('update', 'index') ?>"><?= _t('gen.menu.update') ?></a>
4646
</li>
4747
<?php } ?>

app/layout/nav_menu.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<?php $nav_menu_hooks = Minz_ExtensionManager::callHook('nav_menu'); ?>
180180
<?php if ($nav_menu_hooks != '') { ?>
181181
<div class="stick" id="nav_menu_hooks">
182-
<?php echo $nav_menu_hooks; ?>
182+
<?= $nav_menu_hooks ?>
183183
</div>
184184
<?php } ?>
185185

app/views/helpers/extension/configure.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="post">
22
<h1>
33
<?= $this->extension->getName() ?> (<?= $this->extension->getVersion() ?>) —
4-
<?php echo $this->extension->isEnabled() ? _t('admin.extensions.enabled') : _t('admin.extensions.disabled'); ?>
4+
<?= $this->extension->isEnabled() ? _t('admin.extensions.enabled') : _t('admin.extensions.disabled') ?>
55
</h1>
66

77
<p class="alert alert-warn"><?= $this->extension->getDescription() ?><?= _t('gen.short.by_author'), ' ', $this->extension->getAuthor() ?></p>

app/views/index/normal.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ $today = @strtotime('today');
6161
?></div><?php
6262
$display_others = false;
6363
}
64-
?><div class="flux<?php echo !$this->entry->isRead() ? ' not_read' : '';
65-
?><?php echo $this->entry->isFavorite() ? ' favorite' : '';
66-
?>" id="flux_<?php echo $this->entry->id();
67-
?>" data-feed="<?php echo $this->feed->id();
64+
?><div class="flux<?= !$this->entry->isRead() ? ' not_read' : ''
65+
?><?= $this->entry->isFavorite() ? ' favorite' : ''
66+
?>" id="flux_<?= $this->entry->id()
67+
?>" data-feed="<?= $this->feed->id()
6868
?>"><?php
6969

7070
$this->renderHelper('index/normal/entry_header');

lib/Minz/ExtensionManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function load($info) {
161161

162162
// Test if the given extension class exists.
163163
if (!class_exists($ext_class_name)) {
164-
Minz_Log::warning('`' . $ext_class_name . '` cannot be found in `' . $entry_point_filename . '`');
164+
Minz_Log::warning("`{$ext_class_name}` cannot be found in `{$entry_point_filename}`");
165165
return null;
166166
}
167167

@@ -171,13 +171,13 @@ public static function load($info) {
171171
$extension = new $ext_class_name($info);
172172
} catch (Exception $e) {
173173
// We cannot load the extension? Invalid!
174-
Minz_Log::warning('Invalid extension `' . $ext_class_name . '`: ' . $e->getMessage());
174+
Minz_Log::warning("Invalid extension `{$ext_class_name}`: " . $e->getMessage());
175175
return null;
176176
}
177177

178178
// Test if class is correct.
179179
if (!($extension instanceof Minz_Extension)) {
180-
Minz_Log::warning('`' . $ext_class_name . '` is not an instance of `Minz_Extension`');
180+
Minz_Log::warning("`{$ext_class_name}` is not an instance of `Minz_Extension`");
181181
return null;
182182
}
183183

0 commit comments

Comments
 (0)