diff options
author | Ozh <ozh@ozh.org> | 2012-12-14 16:55:02 +0400 |
---|---|---|
committer | Ozh <ozh@ozh.org> | 2012-12-14 16:55:02 +0400 |
commit | 6a33d8e2ff83adba254b702df479ec6b642befcb (patch) | |
tree | 93b80336843faa7f1cd1e21b50ec2b63bcacfefe /yourls-api.php | |
parent | d81a78709e640f33ae46f1b7dabc12846c2e3dbd (diff) |
Stricter coding: prevent notices in yourls-api.php
git-svn-id: http://yourls.googlecode.com/svn/trunk@823 12232710-3e20-11de-b438-597f59cd7555
Diffstat (limited to 'yourls-api.php')
-rw-r--r-- | yourls-api.php | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/yourls-api.php b/yourls-api.php index 06aed1cf..f27c0b34 100644 --- a/yourls-api.php +++ b/yourls-api.php @@ -16,7 +16,6 @@ switch( $action ) { $title = ( isset( $_REQUEST['title'] ) ? $_REQUEST['title'] : '' );
$return = yourls_add_new_link( $url, $keyword, $title );
$return['simple'] = ( isset( $return['shorturl'] ) ? $return['shorturl'] : '' ); // This one will be used in case output mode is 'simple'
- $return['callback'] = ( isset( $_REQUEST['callback'] ) ? $_REQUEST['callback'] : '' );
unset( $return['html'] ); // in API mode, no need for our internal HTML output
break;
@@ -26,27 +25,23 @@ switch( $action ) { $limit = ( isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : '' );
$start = ( isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : '' );
$return = yourls_api_stats( $filter, $limit, $start );
- $return['callback'] = $_REQUEST['callback'];
break;
// Just the global counts of shorturls and clicks
case "db-stats":
$return = yourls_api_db_stats();
- $return['callback'] = $_REQUEST['callback'];
break;
// Stats for a shorturl
case 'url-stats':
$shorturl = ( isset( $_REQUEST['shorturl'] ) ? $_REQUEST['shorturl'] : '' );
$return = yourls_api_url_stats( $shorturl );
- $return['callback'] = $_REQUEST['callback'];
break;
// Expand a short link
case 'expand':
$shorturl = ( isset( $_REQUEST['shorturl'] ) ? $_REQUEST['shorturl'] : '' );
$return = yourls_api_expand( $shorturl );
- $return['callback'] = $_REQUEST['callback'];
break;
// Unknown action parameter
@@ -62,6 +57,8 @@ switch( $action ) { }
}
+$return['callback'] = ( isset( $_REQUEST['callback'] ) ? $_REQUEST['callback'] : '' );
+
$format = ( isset( $_REQUEST['format'] ) ? $_REQUEST['format'] : 'xml' );
yourls_api_output( $format, $return );
|