diff options
author | Brion Vibber <brion@pobox.com> | 2009-09-20 22:30:10 -0700 |
---|---|---|
committer | Brenda Wallace <shiny@cpan.org> | 2009-09-21 21:34:59 +1200 |
commit | 3c89d31b1883e478d69a121905e5a9a400a17622 (patch) | |
tree | 451c936a5aac0d6916e01fdc7e616915baaa8842 | |
parent | 0125f293245a55a46af202e49bfa98bb983d2c57 (diff) |
Fixes for posting shortened URLs or uploads
* If no shortener plugin is enabled, fall back to using the long URL instead of trying to load nonexistent ur1.ca plugin and throwing 'Class does not exist'
* Fix bad call to call_user_func_array() in callback_helper() which broke all shortening
-rw-r--r-- | lib/util.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/util.php b/lib/util.php index b74dc619c..d9ff8b863 100644 --- a/lib/util.php +++ b/lib/util.php @@ -493,7 +493,7 @@ function callback_helper($matches, $callback, $notice_id) { }while($original_url!=$url); if(empty($notice_id)){ - $result = call_user_func_array($callback,$url); + $result = call_user_func_array($callback, array($url)); }else{ $result = call_user_func_array($callback, array(array($url,$notice_id)) ); } @@ -1374,10 +1374,14 @@ function common_shorten_url($long_url) $svc = $user->urlshorteningservice; } global $_shorteners; - if(! $_shorteners[$svc]){ + if (!isset($_shorteners[$svc])) { //the user selected service doesn't exist, so default to ur1.ca $svc = 'ur1.ca'; } + if (!isset($_shorteners[$svc])) { + // no shortener plugins installed. + return $long_url; + } $reflectionObj = new ReflectionClass($_shorteners[$svc]['callInfo'][0]); $short_url_service = $reflectionObj->newInstanceArgs($_shorteners[$svc]['callInfo'][1]); |