diff options
author | diplopito <26707508+diplopito@users.noreply.github.com> | 2022-04-11 19:21:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 19:21:27 +0300 |
commit | 0866ff2d438dfe11c306f60fa88e21c0f0866ed5 (patch) | |
tree | 7b7f3fe111fc2d9051f71d1ccbe1b932c6e989da | |
parent | 140cfb877eb40bc5fed276139089d8cec001d0da (diff) |
Update view.php (#180)
* Update view.php
When `$type = 'ReJSON-RL'`, a warning is displayed: "Notice: Undefined variable: size in view.php on line 116." This is a small patch while reJson is added to library.
* Update view.php
* Update view.php
Extended `if` code (didn't want to nest ternary operators).
* Update view.php
Default statement updated.
-rw-r--r-- | view.php | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -96,6 +96,9 @@ switch ($type) { } $size = count($values); break; + + default: + $size = -1; } if (isset($values) && ($count_elements_page !== false)) { @@ -113,7 +116,19 @@ if (isset($values) && ($count_elements_page !== false)) { <tr><td><div>Encoding:</div></td><td><div><?php echo format_html($encoding)?></div></td></tr> <?php } ?> -<tr><td><div>Size:</div></td><td><div><?php echo $size?> <?php echo ($type == 'string') ? 'characters' : 'items'?></div></td></tr> +<tr><td><div>Size:</div></td><td><div> +<?php +echo $size; + +if ($type === 'string') { + echo " characters"; +} else if ($size < 0) { + echo " (Type Unsupported)"; +} else { + echo " items"; +} +?> +</div></td></tr> </table> |