From 014d6b1d19b6ae5de8d87f055397993f80579f74 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 11 Nov 2009 14:02:57 -0500 Subject: Redid how URL shorteners work. This way is much more like how Evan wants events to work (and more like how the rest of SN works). --- actions/othersettings.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'actions/othersettings.php') diff --git a/actions/othersettings.php b/actions/othersettings.php index d32a2d651..d52a634ac 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -97,20 +97,15 @@ class OthersettingsAction extends AccountSettingsAction $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); - $services=array(); - global $_shorteners; - if($_shorteners){ - foreach($_shorteners as $name=>$value) - { - $services[$name]=$name; - if(!empty($value['info']['freeService'])){ - // I18N - $services[$name].=' (free service)'; - } + Event::handle('GetUrlShorteners', array(&$shorteners)); + foreach($shorteners as $name=>$value) + { + $services[$name]=$name; + if($value['freeService']){ + $services[$name].=_(' (free service)'); } } asort($services); - $services['']='None'; $this->elementStart('ul', 'form_data'); $this->elementStart('li'); -- cgit v1.2.3-54-g00ecf From 23290f746f7ef9567e95ecbb06baf17f246a3fe7 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 11 Nov 2009 17:05:24 -0500 Subject: Do not show the URL shortener selection drop down if no shorteners are available --- actions/othersettings.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'actions/othersettings.php') diff --git a/actions/othersettings.php b/actions/othersettings.php index d52a634ac..1d252f34e 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -96,6 +96,7 @@ class OthersettingsAction extends AccountSettingsAction common_local_url('othersettings'))); $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); + $this->elementStart('ul', 'form_data'); Event::handle('GetUrlShorteners', array(&$shorteners)); foreach($shorteners as $name=>$value) @@ -105,14 +106,16 @@ class OthersettingsAction extends AccountSettingsAction $services[$name].=_(' (free service)'); } } - asort($services); + if($services) + { + asort($services); - $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->dropdown('urlshorteningservice', _('Shorten URLs with'), - $services, _('Automatic shortening service to use.'), - false, $user->urlshorteningservice); - $this->elementEnd('li'); + $this->elementStart('li'); + $this->dropdown('urlshorteningservice', _('Shorten URLs with'), + $services, _('Automatic shortening service to use.'), + false, $user->urlshorteningservice); + $this->elementEnd('li'); + } $this->elementStart('li'); $this->checkbox('viewdesigns', _('View profile designs'), $user->viewdesigns, _('Show or hide profile designs.')); -- cgit v1.2.3-54-g00ecf From 8a6590a7e800e33787ffc55dbd0b2b36ff140504 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 11 Nov 2009 17:09:00 -0500 Subject: initialize these variables before use to prevent warnings --- actions/othersettings.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actions/othersettings.php') diff --git a/actions/othersettings.php b/actions/othersettings.php index 1d252f34e..0de7cd908 100644 --- a/actions/othersettings.php +++ b/actions/othersettings.php @@ -98,7 +98,9 @@ class OthersettingsAction extends AccountSettingsAction $this->hidden('token', common_session_token()); $this->elementStart('ul', 'form_data'); + $shorteners = array(); Event::handle('GetUrlShorteners', array(&$shorteners)); + $services = array(); foreach($shorteners as $name=>$value) { $services[$name]=$name; -- cgit v1.2.3-54-g00ecf