Beispiel #1
0
/**
 * API function wrapper: Stats about links (XX top, bottom, last, rand)
 *
 * @since 1.6
 * @return array Result of API call
 */
function yourls_api_action_stats()
{
    $filter = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '';
    $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : '';
    $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : '';
    return yourls_apply_filter('api_result_stats', yourls_api_stats($filter, $limit, $start));
}
Beispiel #2
0
 case 'shorturl':
     $url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
     $keyword = isset($_REQUEST['keyword']) ? $_REQUEST['keyword'] : '';
     $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'
     unset($return['html']);
     // in API mode, no need for our internal HTML output
     break;
     // Global stats
 // Global stats
 case 'stats':
     $filter = isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '';
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : '';
     $return = yourls_api_stats($filter, $limit);
     break;
     // Stats for a shorturl
 // Stats for a shorturl
 case 'url-stats':
     $shorturl = isset($_REQUEST['shorturl']) ? $_REQUEST['shorturl'] : '';
     $return = yourls_api_url_stats($shorturl);
     break;
     // Expand a short link
 // Expand a short link
 case 'expand':
     $shorturl = isset($_REQUEST['shorturl']) ? $_REQUEST['shorturl'] : '';
     $return = yourls_api_expand($shorturl);
     break;
     // Missing or incorrect action parameter
 // Missing or incorrect action parameter
Beispiel #3
-1
<?php

// Get the YOURLS stuff.
require_once dirname(__FILE__) . '/includes/load-yourls.php';
// Get the Short URLs
$items = yourls_api_stats('last', 20);
// Let make sure we are serving the right type.
header('Content-Type: application/atom+xml');
// I'm not sure what's going on here but if removed everything gose nuts.
echo '<?' . 'xml version="1.0" encoding="UTF-8" ?>';
?>

<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Latest links on <?php 
echo YOURLS_SITE;
?>
</title>
		<link><?php 
echo YOURLS_SITE;
?>
</link>
		<description>Latest links on <?php 
echo YOURLS_SITE;
?>
</description>
		<atom:link href="<?php 
echo YOURLS_SITE;
?>
/rss.php" rel="self" type="application/rss+xml" />
		<generator>YOURLS v<?php