diff options
| author | 2019-10-23 11:18:20 +0200 | |
|---|---|---|
| committer | 2019-10-23 11:18:20 +0200 | |
| commit | 7a5236de3f13f08b8c51eb183c0dcf1c8c85beca (patch) | |
| tree | 10a09f07458ed1279e62646188cb42e87fe0ed8f /app/views/stats | |
| parent | fdfd8ce9be182943e73d20ec3bff4d560c5b7503 (diff) | |
Take advantage of PHP 5.4+ short echo (#2585)
* Take advantage of PHP 5.4+ short echo
https://php.net/migration54.new-features thanks to
https://github.com/FreshRSS/FreshRSS/pull/2495
Use `<?= ?>` instead of `<?php echo; ?>`
10kB of code saved :-)
Done with regular expression:
```
<\?php echo (.+?);? *\?>
<?= \1 ?>
```
* Try Travis fix
https://github.com/squizlabs/PHP_CodeSniffer/issues/2045#issuecomment-395238272
Diffstat (limited to 'app/views/stats')
| -rw-r--r-- | app/views/stats/idle.phtml | 18 | ||||
| -rw-r--r-- | app/views/stats/index.phtml | 60 | ||||
| -rw-r--r-- | app/views/stats/repartition.phtml | 34 |
3 files changed, 56 insertions, 56 deletions
diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index 88c78d465..9421893fb 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -1,9 +1,9 @@ <?php $this->partial('aside_stats'); ?> <div class="post"> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + <a href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a> - <h1><?php echo _t('admin.stats.idle'); ?></h1> + <h1><?= _t('admin.stats.idle') ?></h1> <?php $current_url = Minz_Url::display( @@ -16,21 +16,21 @@ $nothing = false; ?> <div class="stat"> - <h2><?php echo _t('gen.date.' . $period); ?></h2> + <h2><?= _t('gen.date.' . $period) ?></h2> <form id="form-delete" method="post"> - <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" /> <?php foreach ($feeds as $feed) { ?> <ul class="horizontal-list"> <li class="item"> <div class="stick"> - <a class="btn" href="<?php echo _url('index', 'index', 'get', 'f_' . $feed['id']); ?>"><?php echo _i('link'); ?> <?php echo _t('gen.action.filter'); ?></a> - <a class="btn" href="<?php echo _url('subscription', 'index', 'id', $feed['id']); ?>"><?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?></a> - <button class="btn btn-attention confirm" form="form-delete" formaction="<?php echo _url('feed', 'delete', 'id', $feed['id'], 'r', $current_url); ?>"><?php echo _t('gen.action.remove'); ?></button> + <a class="btn" href="<?= _url('index', 'index', 'get', 'f_' . $feed['id']) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a> + <a class="btn" href="<?= _url('subscription', 'index', 'id', $feed['id']) ?>"><?= _i('configure') ?> <?= _t('gen.action.manage') ?></a> + <button class="btn btn-attention confirm" form="form-delete" formaction="<?= _url('feed', 'delete', 'id', $feed['id'], 'r', $current_url) ?>"><?= _t('gen.action.remove') ?></button> </div> </li> <li class="item"> - <span title="<?php echo timestamptodate($feed['last_date'], false); ?>"><?php echo $feed['name']; ?> (<?php echo _t('admin.stats.number_entries', $feed['nb_articles']); ?>)</span> + <span title="<?= timestamptodate($feed['last_date'], false) ?>"><?= $feed['name'] ?> (<?= _t('admin.stats.number_entries', $feed['nb_articles']) ?>)</span> </li> </ul> <?php } ?> @@ -43,7 +43,7 @@ if ($nothing) { ?> <p class="alert alert-warn"> - <span class="alert-head"><?php echo _t('admin.stats.no_idle'); ?></span> + <span class="alert-head"><?= _t('admin.stats.no_idle') ?></span> </p> <?php } ?> </div> diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 2ff3e6c52..4af197c5b 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -1,63 +1,63 @@ <?php $this->partial('aside_stats'); ?> <div class="post"> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + <a href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a> - <h1><?php echo _t('admin.stats.main'); ?></h1> + <h1><?= _t('admin.stats.main') ?></h1> <div class="stat half"> - <h2><?php echo _t('admin.stats.entry_repartition'); ?></h2> + <h2><?= _t('admin.stats.entry_repartition') ?></h2> <table> <thead> <tr> <th> </th> - <th><?php echo _t('admin.stats.main_stream'); ?></th> - <th><?php echo _t('admin.stats.all_feeds'); ?></th> + <th><?= _t('admin.stats.main_stream') ?></th> + <th><?= _t('admin.stats.all_feeds') ?></th> </tr> </thead> <tbody> <tr> - <th><?php echo _t('admin.stats.status_total'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['total']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['total']); ?></td> + <th><?= _t('admin.stats.status_total') ?></th> + <td class="numeric"><?= format_number($this->repartition['main_stream']['total']) ?></td> + <td class="numeric"><?= format_number($this->repartition['all_feeds']['total']) ?></td> </tr> <tr> - <th><?php echo _t('admin.stats.status_read'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_reads']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_reads']); ?></td> + <th><?= _t('admin.stats.status_read') ?></th> + <td class="numeric"><?= format_number($this->repartition['main_stream']['count_reads']) ?></td> + <td class="numeric"><?= format_number($this->repartition['all_feeds']['count_reads']) ?></td> </tr> <tr> - <th><?php echo _t('admin.stats.status_unread'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_unreads']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_unreads']); ?></td> + <th><?= _t('admin.stats.status_unread') ?></th> + <td class="numeric"><?= format_number($this->repartition['main_stream']['count_unreads']) ?></td> + <td class="numeric"><?= format_number($this->repartition['all_feeds']['count_unreads']) ?></td> </tr> <tr> - <th><?php echo _t('admin.stats.status_favorites'); ?></th> - <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_favorites']); ?></td> - <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_favorites']); ?></td> + <th><?= _t('admin.stats.status_favorites') ?></th> + <td class="numeric"><?= format_number($this->repartition['main_stream']['count_favorites']) ?></td> + <td class="numeric"><?= format_number($this->repartition['all_feeds']['count_favorites']) ?></td> </tr> </tbody> </table> </div><!-- --><div class="stat half"> - <h2><?php echo _t('admin.stats.top_feed'); ?></h2> + <h2><?= _t('admin.stats.top_feed') ?></h2> <table> <thead> <tr> - <th><?php echo _t('admin.stats.feed'); ?></th> - <th><?php echo _t('admin.stats.category'); ?></th> - <th><?php echo _t('admin.stats.entry_count'); ?></th> - <th><?php echo _t('admin.stats.percent_of_total'); ?></th> + <th><?= _t('admin.stats.feed') ?></th> + <th><?= _t('admin.stats.category') ?></th> + <th><?= _t('admin.stats.entry_count') ?></th> + <th><?= _t('admin.stats.percent_of_total') ?></th> </tr> </thead> <tbody> <?php foreach ($this->topFeed as $feed) { ?> <tr> - <td><a href="<?php echo _url('stats', 'repartition', 'id', $feed['id']); ?>"><?php echo $feed['name']; ?></a></td> - <td><?php echo $feed['category']; ?></td> - <td class="numeric"><?php echo format_number($feed['count']); ?></td> - <td class="numeric"><?php echo format_number($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1);?></td> + <td><a href="<?= _url('stats', 'repartition', 'id', $feed['id']) ?>"><?= $feed['name'] ?></a></td> + <td><?= $feed['category'] ?></td> + <td class="numeric"><?= format_number($feed['count']) ?></td> + <td class="numeric"><?= format_number($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1) ?></td> </tr> <?php } ?> </tbody> @@ -65,18 +65,18 @@ </div> <div class="stat"> - <h2><?php echo _t('admin.stats.entry_per_day'); ?></h2> + <h2><?= _t('admin.stats.entry_per_day') ?></h2> <div id="statsEntryPerDay" class="statGraph"></div> </div> <div class="stat half"> - <h2><?php echo _t('admin.stats.feed_per_category'); ?></h2> + <h2><?= _t('admin.stats.feed_per_category') ?></h2> <div id="statsFeedPerCategory" class="statGraph"></div> <div id="statsFeedPerCategoryLegend"></div> </div> <div class="stat half"> - <h2><?php echo _t('admin.stats.entry_per_category'); ?></h2> + <h2><?= _t('admin.stats.entry_per_category') ?></h2> <div id="statsEntryPerCategory" class="statGraph"></div> <div id="statsEntryPerCategoryLegend"></div> </div> @@ -90,4 +90,4 @@ echo htmlspecialchars(json_encode(array( 'entryByCategory' => $this->entryByCategory, ), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES, 'UTF-8'); ?></script> -<script src="../scripts/stats.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/stats.js'); ?>"></script> +<script src="../scripts/stats.js?<?= @filemtime(PUBLIC_PATH . '/scripts/stats.js') ?>"></script> diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index 4bce418c9..7b445a7cc 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -1,12 +1,12 @@ <?php $this->partial('aside_stats'); ?> <div class="post "> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + <a href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a> - <h1><?php echo _t('admin.stats.repartition'); ?></h1> + <h1><?= _t('admin.stats.repartition') ?></h1> <select id="feed_select" class="select-change"> - <option data-url="<?php echo _url('stats', 'repartition')?>"><?php echo _t('admin.stats.all_feeds')?></option> + <option data-url="<?= _url('stats', 'repartition') ?>"><?= _t('admin.stats.all_feeds') ?></option> <?php foreach ($this->categories as $category) { $feeds = $category->feeds(); if (!empty($feeds)) { @@ -24,40 +24,40 @@ </select> <?php if ($this->feed) {?> - <a class="btn" href="<?php echo _url('subscription', 'index', 'id', $this->feed->id()); ?>"> - <?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?> + <a class="btn" href="<?= _url('subscription', 'index', 'id', $this->feed->id()) ?>"> + <?= _i('configure') ?> <?= _t('gen.action.manage') ?> </a> <?php }?> <div class="stat"> <table> <tr> - <th><?php echo _t('admin.stats.status_total'); ?></th> - <th><?php echo _t('admin.stats.status_read'); ?></th> - <th><?php echo _t('admin.stats.status_unread'); ?></th> - <th><?php echo _t('admin.stats.status_favorites'); ?></th> + <th><?= _t('admin.stats.status_total') ?></th> + <th><?= _t('admin.stats.status_read') ?></th> + <th><?= _t('admin.stats.status_unread') ?></th> + <th><?= _t('admin.stats.status_favorites') ?></th> </tr> <tr> - <td class="numeric"><?php echo $this->repartition['total']; ?></td> - <td class="numeric"><?php echo $this->repartition['count_reads']; ?></td> - <td class="numeric"><?php echo $this->repartition['count_unreads']; ?></td> - <td class="numeric"><?php echo $this->repartition['count_favorites']; ?></td> + <td class="numeric"><?= $this->repartition['total'] ?></td> + <td class="numeric"><?= $this->repartition['count_reads'] ?></td> + <td class="numeric"><?= $this->repartition['count_unreads'] ?></td> + <td class="numeric"><?= $this->repartition['count_favorites'] ?></td> </tr> </table> </div> <div class="stat"> - <h2><?php echo _t('admin.stats.entry_per_hour', $this->averageHour); ?></h2> + <h2><?= _t('admin.stats.entry_per_hour', $this->averageHour) ?></h2> <div id="statsEntryPerHour" class="statGraph"></div> </div> <div class="stat half"> - <h2><?php echo _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek); ?></h2> + <h2><?= _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek) ?></h2> <div id="statsEntryPerDayOfWeek" class="statGraph"></div> </div> <div class="stat half"> - <h2><?php echo _t('admin.stats.entry_per_month', $this->averageMonth); ?></h2> + <h2><?= _t('admin.stats.entry_per_month', $this->averageMonth) ?></h2> <div id="statsEntryPerMonth" class="statGraph"></div> </div> </div> @@ -71,4 +71,4 @@ echo htmlspecialchars(json_encode(array( 'months' => $this->months, ), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES, 'UTF-8'); ?></script> -<script src="../scripts/repartition.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/repartition.js'); ?>"></script> +<script src="../scripts/repartition.js?<?= @filemtime(PUBLIC_PATH . '/scripts/repartition.js') ?>"></script> |
