From 7df082abb8f9570e55bac209068146e34b3781b4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 28 Oct 2009 14:21:42 -0400 Subject: [PATCH] replace some boolean-evaluations with calls to empty() --- classes/Notice.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index cd3906ca17..44eded8e83 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -172,7 +172,7 @@ class Notice extends Memcached_DataObject throw new ClientException(_('Problem saving notice. Too long.')); } - if (!$profile) { + if (empty($profile)) { throw new ClientException(_('Problem saving notice. Unknown user.')); } @@ -307,11 +307,11 @@ class Notice extends Memcached_DataObject static function checkDupes($profile_id, $content) { $profile = Profile::staticGet($profile_id); - if (!$profile) { + if (empty($profile)) { return false; } $notice = $profile->getNotices(0, NOTICE_CACHE_WINDOW); - if ($notice) { + if (!empty($notice)) { $last = 0; while ($notice->fetch()) { if (time() - strtotime($notice->created) >= common_config('site', 'dupelimit')) { @@ -337,7 +337,7 @@ class Notice extends Memcached_DataObject static function checkEditThrottle($profile_id) { $profile = Profile::staticGet($profile_id); - if (!$profile) { + if (empty($profile)) { return false; } # Get the Nth notice @@ -658,7 +658,7 @@ class Notice extends Memcached_DataObject $cache = common_memcache(); - if (!$cache) { + if (empty($cache)) { return Notice::getStreamDirect($qry, $offset, $limit, null, null, $order, null); } @@ -719,7 +719,7 @@ class Notice extends Memcached_DataObject # If there are no hits, just return the value - if (!$notice) { + if (empty($notice)) { return $notice; } @@ -1061,12 +1061,12 @@ class Notice extends Memcached_DataObject for ($i=0; $icreated); - if (!$recipient) { + if (empty($recipient)) { continue; } // Don't save replies from blocked profile to local user $recipient_user = User::staticGet('id', $recipient->id); - if ($recipient_user && $recipient_user->hasBlocked($sender)) { + if (!empty($recipient_user) && $recipient_user->hasBlocked($sender)) { continue; } $reply = new Reply(); -- 2.39.5