diff --git a/controllers/bookmark.php b/controllers/bookmark.php index f36456e..ba184e1 100644 --- a/controllers/bookmark.php +++ b/controllers/bookmark.php @@ -38,7 +38,7 @@ Router\get_action('bookmarks', function () { $group_id = Request\int_param('group_id', null); $feed_ids = array(); - if (! is_null($group_id)) { + if ($group_id !== null) { $feed_ids = Model\Group\get_feeds_by_group($group_id); } diff --git a/controllers/common.php b/controllers/common.php index 8af9551..0384e54 100644 --- a/controllers/common.php +++ b/controllers/common.php @@ -7,7 +7,7 @@ Router\before(function ($action) { // Select the requested database either from post param database or from the // session variable. If it fails, logout to destroy session and // 'remember me' cookie - if (! is_null(Request\value('database')) && ! Model\Database\select(Request\value('database'))) { + if (Request\value('database') !== null && ! Model\Database\select(Request\value('database'))) { Model\User\logout(); Response\redirect('?action=login'); } elseif (! empty($_SESSION['database'])) { diff --git a/controllers/history.php b/controllers/history.php index 3849cb7..aa6d167 100644 --- a/controllers/history.php +++ b/controllers/history.php @@ -8,7 +8,7 @@ Router\get_action('history', function () { $group_id = Request\int_param('group_id', null); $feed_ids = array(); - if (! is_null($group_id)) { + if ($group_id !== null) { $feed_ids = Model\Group\get_feeds_by_group($group_id); } @@ -59,7 +59,7 @@ Router\get_action('confirm-flush-history', function () { Router\get_action('flush-history', function () { $group_id = Request\int_param('group_id', null); - if (!is_null($group_id)) { + if ($group_id !== null) { Model\Item\mark_group_as_removed($group_id); } else { Model\Item\mark_all_as_removed(); diff --git a/controllers/item.php b/controllers/item.php index 46cf3f3..dfc2108 100644 --- a/controllers/item.php +++ b/controllers/item.php @@ -11,7 +11,7 @@ Router\get_action('unread', function () { $group_id = Request\int_param('group_id', null); $feed_ids = array(); - if (! is_null($group_id)) { + if ($group_id !== null) { $feed_ids = Model\Group\get_feeds_by_group($group_id); } @@ -160,7 +160,7 @@ Router\post_action('mark-item-unread', function () { Router\get_action('mark-all-read', function () { $group_id = Request\int_param('group_id', null); - if (!is_null($group_id)) { + if ($group_id !== null) { Model\Item\mark_group_as_read($group_id); } else { Model\Item\mark_all_as_read(); diff --git a/fever/index.php b/fever/index.php index fedc801..dedfe90 100644 --- a/fever/index.php +++ b/fever/index.php @@ -309,7 +309,7 @@ foreach (array_keys($_GET) as $action) { } if (! empty($_POST['mark']) && ! empty($_POST['as']) - && ! is_null(filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT, array('options' => array('default' => null, 'min_range' => -1))))) { + && filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT, array('options' => array('default' => null, 'min_range' => -1))) !== null) { if ($_POST['mark'] === 'item') { route('write_items'); } elseif ($_POST['mark'] === 'feed' && ! empty($_POST['before'])) { diff --git a/lib/Translator.php b/lib/Translator.php index 3024856..1b943b9 100644 --- a/lib/Translator.php +++ b/lib/Translator.php @@ -109,7 +109,7 @@ namespace Translator { } } - for ($i = $plural; $i >= 0; $i--) { + for ($i = $plural; $i >= 0; --$i) { if (isset($locales[$identifier][$i])) { return $locales[$identifier][$i]; } diff --git a/lib/helpers.php b/lib/helpers.php index a741472..ee8231b 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -17,7 +17,7 @@ function parse_app_version($refnames, $commithash) if ($refnames !== '$Format:%d$') { $tag = preg_replace('/\s*\(.*tag:\sv([^,]+).*\)/i', '\1', $refnames); - if (!is_null($tag) && $tag !== $refnames) { + if ($tag !== null && $tag !== $refnames) { return $tag; } } @@ -222,7 +222,7 @@ function form_hidden($name, $values = array()) function form_default_select($name, array $options, $values = array(), array $errors = array(), $class = '') { - $options = array('' => '?') + $options; + $options += array('' => '?'); return form_select($name, $options, $values, $errors, $class); } diff --git a/lib/password.php b/lib/password.php index d4972ab..a2d9530 100644 --- a/lib/password.php +++ b/lib/password.php @@ -114,9 +114,9 @@ if (!defined('PASSWORD_BCRYPT')) { } if (!$buffer_valid || strlen($buffer) < $raw_length) { $bl = strlen($buffer); - for ($i = 0; $i < $raw_length; $i++) { + for ($i = 0; $i < $raw_length; ++$i) { if ($i < $bl) { - $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255)); + $buffer[$i] ^= chr(mt_rand(0, 255)); } else { $buffer .= chr(mt_rand(0, 255)); } @@ -212,12 +212,13 @@ if (!defined('PASSWORD_BCRYPT')) { return false; } $ret = crypt($password, $hash); - if (!is_string($ret) || strlen($ret) != strlen($hash) || strlen($ret) <= 13) { + $len = strlen($ret); + if (!is_string($ret) || $len != strlen($hash) || $len <= 13) { return false; } $status = 0; - for ($i = 0; $i < strlen($ret); $i++) { + for ($i = 0; $i < $len; ++$i) { $status |= (ord($ret[$i]) ^ ord($hash[$i])); } diff --git a/models/item.php b/models/item.php index c043cdf..8ba36b6 100644 --- a/models/item.php +++ b/models/item.php @@ -244,7 +244,7 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee $next_item = null; $previous_item = null; - for ($i = 0, $ilen = count($items); $i < $ilen; $i++) { + for ($i = 0, $ilen = count($items); $i < $ilen; ++$i) { if ($items[$i]['id'] == $item['id']) { if ($i > 0) { $j = $i - 1; @@ -255,7 +255,7 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee break; } - $j--; + --$j; } } @@ -268,7 +268,7 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee break; } - $j++; + ++$j; } } diff --git a/scripts/sync-locales.php b/scripts/sync-locales.php index f36fc70..f3169e3 100755 --- a/scripts/sync-locales.php +++ b/scripts/sync-locales.php @@ -49,7 +49,7 @@ foreach (new DirectoryIterator('locales') as $fileInfo) { $filename = 'locales/'.$fileInfo->getFilename().'/translations.php'; - echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL; + echo $fileInfo->getFilename(), ' (', $filename, ')', PHP_EOL; file_put_contents($filename, update_missing_locales($reference, $filename)); } diff --git a/templates/about.php b/templates/about.php index 5ce74da..bd5707a 100644 --- a/templates/about.php +++ b/templates/about.php @@ -16,7 +16,7 @@
= t('No bookmark') ?>
diff --git a/templates/confirm_flush_items.php b/templates/confirm_flush_items.php index c554bba..f165989 100644 --- a/templates/confirm_flush_items.php +++ b/templates/confirm_flush_items.php @@ -5,6 +5,6 @@= t('Do you really want to remove these items from your history?') ?>