Просмотр исходного кода

Minor update syntax echo (#7941)

* Minor update syntax echo
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/7939

* Fix layout
Whitespace optimisation needed to avoid style glitch
Alexandre Alapetite 6 месяцев назад
Родитель
Сommit
8bd9bd95d8

+ 5 - 6
app/layout/aside_feed.phtml

@@ -92,13 +92,12 @@
 					$c_show = ($c_active && in_array(FreshRSS_Context::userConf()->display_categories, ['active', 'remember'], true))
 						|| FreshRSS_Context::userConf()->display_categories === 'all';
 		?>
-		<li id="c_<?= $cat->id() ?>" class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?=
-			null === $position ? '' : " data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>">
+		<li id="c_<?= $cat->id() ?>" class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?= null === $position ? '' : " data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>">
 			<a href="<?= _url('index', $actual_view, 'get', 'c_' . $cat->id()) . $state_filter_manual ?>" class="tree-folder-title">
-				<button class="dropdown-toggle" title="<?= _t('sub.category.expand') ?>"><?= _i($c_show ? 'up' : 'down') ?></button><span title="<?= _t('sub.category.open') ?>" class="title<?= $cat->hasFeedsWithError() ? ' error' : '' ?>" data-unread="<?=
-					format_number($cat->nbNotRead()) ?>" ><?=
-						$cat->name()
-					?><?php if ($cat->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) { echo _i('opml-dyn'); } ?></span>
+				<button class="dropdown-toggle" title="<?= _t('sub.category.expand') ?>"><?= _i($c_show ? 'up' : 'down') ?></button><?php
+				?><span title="<?= _t('sub.category.open') ?>" class="title<?= $cat->hasFeedsWithError() ? ' error' : '' ?>" data-unread="<?= format_number($cat->nbNotRead()) ?>" ><?=
+					$cat->name() ?><?= $cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML ? _i('opml-dyn') : ''
+				?></span>
 			</a>
 
 			<ul class="tree-folder-items<?= $c_show ? ' active' : '' ?>">

+ 1 - 1
app/layout/nav_menu.phtml

@@ -196,7 +196,7 @@
 		/** @var FreshRSS_ReadingMode $mode */
 		foreach ($readingModes as $mode) {
 			?>
-			<a class="<?= $mode->getId() ?> btn <?php if ($mode->isActive()) { echo 'active'; } ?>" title="<?=
+			<a class="<?= $mode->getId() ?> btn <?= $mode->isActive() ? 'active' : '' ?>" title="<?=
 				$mode->getTitle() ?>" href="<?= Minz_Url::display($mode->getUrlParams()) ?>">
 				<?= $mode->getName() ?>
 			</a>

+ 1 - 1
app/views/helpers/category/update.phtml

@@ -8,7 +8,7 @@
 <div class="post">
 	<h2>
 		<?= $this->category->name() ?>
-		<?php if ($this->category->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) { echo _i('opml-dyn'); } ?>
+		<?= $this->category->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML ? _i('opml-dyn') : '' ?>
 	</h2>
 
 	<div>

+ 8 - 8
app/views/helpers/feed/update.phtml

@@ -115,14 +115,14 @@
 				<label class="group-name" for="priority"><?= _t('sub.feed.priority') ?></label>
 				<div class="group-controls">
 					<select name="priority" id="priority" class="w50">
-						<option value='<?= FreshRSS_Feed::PRIORITY_IMPORTANT ?>' <?php
-							if (FreshRSS_Feed::PRIORITY_IMPORTANT === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.important') ?></option>
-						<option value='<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>' <?php
-							if (FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.main_stream') ?></option>
-						<option value='<?= FreshRSS_Feed::PRIORITY_CATEGORY ?>' <?php
-							if (FreshRSS_Feed::PRIORITY_CATEGORY === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.category') ?></option>
-						<option value='<?= FreshRSS_Feed::PRIORITY_ARCHIVED ?>' <?php
-							if (FreshRSS_Feed::PRIORITY_ARCHIVED === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.archived') ?></option>
+						<option value="<?= FreshRSS_Feed::PRIORITY_IMPORTANT ?>" <?=
+							FreshRSS_Feed::PRIORITY_IMPORTANT === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.important') ?></option>
+						<option value="<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>" <?=
+							FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.main_stream') ?></option>
+						<option value="<?= FreshRSS_Feed::PRIORITY_CATEGORY ?>" <?=
+							FreshRSS_Feed::PRIORITY_CATEGORY === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.category') ?></option>
+						<option value="<?= FreshRSS_Feed::PRIORITY_ARCHIVED ?>" <?=
+							FreshRSS_Feed::PRIORITY_ARCHIVED === $this->feed->priority() ? 'selected="selected"' : '' ?>><?= _t('sub.feed.priority.archived') ?></option>
 					</select>
 					<?= _i('important') ?>
 				</div>

+ 4 - 4
app/views/helpers/index/normal/entry_bottom.phtml

@@ -19,8 +19,8 @@
 				if ($this->entry->isRead()) {
 					$arUrl['params']['is_read'] = '0';
 				}
-				?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
-					echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
+				?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?=
+					_i($this->entry->isRead() ? 'read' : 'unread') ?></a><?php
 			?></li><?php
 		}
 		if ($bottomline_favorite) {
@@ -29,8 +29,8 @@
 				if ($this->entry->isFavorite()) {
 					$arUrl['params']['is_favorite'] = '0';
 				}
-				?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
-					echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
+				?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?=
+					_i($this->entry->isFavorite() ? 'starred' : 'non-starred') ?></a><?php
 			?></li><?php
 		}
 	}

+ 4 - 4
app/views/helpers/index/normal/entry_header.phtml

@@ -23,8 +23,8 @@
 				if ($this->entry->isRead()) {
 					$arUrl['params']['is_read'] = '0';
 				}
-				?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
-					echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
+				?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?=
+					_i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
 			?></li><?php
 		}
 		if ($topline_favorite) {
@@ -33,8 +33,8 @@
 				if ($this->entry->isFavorite()) {
 					$arUrl['params']['is_favorite'] = '0';
 				}
-				?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
-					echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
+				?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?=
+					_i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
 			?></li><?php
 		}
 	}

+ 9 - 12
app/views/stats/repartition.phtml

@@ -74,15 +74,14 @@
 		<div class="box-title"><h2><?= _t('admin.stats.entry_per_hour', $this->averageHour) ?></h2></div>
 		<div class="box-content scrollbar-thin">
 			<canvas id="statsEntriesPerHour"></canvas>
-			<script class="jsonData-stats" type="application/json">
-			<?php
-			echo json_encode([
+			<script class="jsonData-stats" type="application/json"><?=
+			json_encode([
 				'canvasID' 		=> 'statsEntriesPerHour',
 				'charttype' 	=> 'bar',
 				'data' 			=> $this->repartitionHour,
 				'label' 		=> _t('admin.stats.entry_count'),
 				'xAxisLabels' 	=> $this->hours24Labels
-			], JSON_UNESCAPED_UNICODE);
+			], JSON_UNESCAPED_UNICODE)
 			?></script>
 		</div>
 	</div>
@@ -92,15 +91,14 @@
 		<div class="box-title"><h2><?= _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek) ?></h2></div>
 		<div class="box-content scrollbar-thin">
 			<canvas id="statsEntriesPerDayOfWeek"></canvas>
-			<script class="jsonData-stats" type="application/json">
-			<?php
-			echo json_encode([
+			<script class="jsonData-stats" type="application/json"><?=
+			json_encode([
 				'canvasID' 		=> 'statsEntriesPerDayOfWeek',
 				'charttype' 	=> 'bar',
 				'data' 			=> $this->repartitionDayOfWeek,
 				'label' 		=> _t('admin.stats.entry_count'),
 				'xAxisLabels' 	=> $this->days,
-			], JSON_UNESCAPED_UNICODE);
+			], JSON_UNESCAPED_UNICODE)
 			?></script>
 		</div>
 	</div>
@@ -109,15 +107,14 @@
 		<div class="box-title"><h2><?= _t('admin.stats.entry_per_month', $this->averageMonth) ?></h2></div>
 		<div class="box-content scrollbar-thin">
 			<canvas id="statsEntriesPerMonth"></canvas>
-			<script class="jsonData-stats" type="application/json">
-			<?php
-			echo json_encode([
+			<script class="jsonData-stats" type="application/json"><?=
+			json_encode([
 				'canvasID' 		=> 'statsEntriesPerMonth',
 				'charttype' 	=> 'bar',
 				'data' 			=> $this->repartitionMonth,
 				'label' 		=> _t('admin.stats.entry_count'),
 				'xAxisLabels' 	=> $this->months,
-			], JSON_UNESCAPED_UNICODE);
+			], JSON_UNESCAPED_UNICODE)
 			?></script>
 		</div>
 	</div>

+ 1 - 1
app/views/subscription/index.phtml

@@ -31,7 +31,7 @@
 		<div class="box">
 			<div class="box-title">
 				<a class="configure open-slider" href="<?= _url('category', 'update', 'id', $cat->id()) ?>" title="<?= _t('gen.action.manage') ?>" data-cat-position="<?= $cat->attributeString('position') ?>"><?= _i('configure') ?></a>
-				<h2><?= $cat->name() ?><?php if ($cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML) { echo " " . _i('opml-dyn'); } ?></h2>
+				<h2><?= $cat->name() ?><?= $cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML ? ' ' . _i('opml-dyn') : '' ?></h2>
 			</div>
 			<ul class="box-content drop-zone scrollbar-thin" dropzone="move" data-cat-id="<?= $cat->id() ?>">
 				<?php

+ 1 - 1
app/views/user/details.phtml

@@ -9,7 +9,7 @@
 	$enabled = $this->details['enabled'];
 ?>
 <div class="post">
-	<h2><?= $this->username ?><?php if ($isAdmin) echo ' ― ', _t('admin.user.admin'); ?></h2>
+	<h2><?= $this->username ?><?= $isAdmin ? ' ― ' . _t('admin.user.admin') : '' ?></h2>
 	<form method="post" action="<?= _url('user', 'manage', 'username', $this->username); ?>" data-auto-leave-validation="1">
 		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken(); ?>" />