From 79f81ad76d413908c097c121912eff233aebc483 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 11 Dec 2009 11:29:51 -0500 Subject: change Notice::saveNew() to use named arguments for little-used options --- actions/apistatusesupdate.php | 29 ++++++++++++++++------------- actions/newnotice.php | 10 ++++++---- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'actions') diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 85a7c8c08..10bbc5ace 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -231,19 +231,22 @@ class ApiStatusesUpdateAction extends ApiAuthAction } } - $this->notice = Notice::saveNew( - $this->user->id, - html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'), - $this->source, - 1, - $reply_to, - null, - null, - empty($location) ? null : $location->lat, - empty($location) ? null : $location->lon, - empty($location) ? null : $location->location_id, - empty($location) ? null : $location->location_ns - ); + $content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'), + + $options = array('reply_to' => $reply_to); + + if (!empty($location)) { + $options['lat'] = $location->lat; + $options['lon'] = $location->lon; + $options['location_id'] = $location->location_id; + $options['location_ns'] = $location->location_ns; + } + + $this->notice = + Notice::saveNew($this->user->id, + $content, + $this->source, + $options); if (isset($upload)) { $upload->attachToNotice($this->notice); diff --git a/actions/newnotice.php b/actions/newnotice.php index dd6da0b01..c6c70e326 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -187,10 +187,12 @@ class NewnoticeAction extends Action } } - $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1, - ($replyto == 'false') ? null : $replyto, - null, null, - $lat, $lon, $location_id, $location_ns); + $notice = Notice::saveNew($user->id, $content_shortened, 'web', + array('reply_to' => ($replyto == 'false') ? null : $replyto, + 'lat' => $lat, + 'lon' => $lon, + 'location_id' => $location_id, + 'location_ns' => $location_ns)); if (isset($upload)) { $upload->attachToNotice($notice); -- cgit v1.2.3-54-g00ecf From 89256fa754c1e03b822b8eeac388cc822b3c58ca Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 11 Dec 2009 11:33:26 -0500 Subject: fix typo in API arg creation --- actions/apistatusesupdate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions') diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 10bbc5ace..dabbea92f 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -231,7 +231,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction } } - $content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'), + $content = html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'); $options = array('reply_to' => $reply_to); -- cgit v1.2.3-54-g00ecf