1 Star 0 Fork 0

Changkey/YOURLS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
yourls-api.php 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
ozh 提交于 2014-10-26 19:00 . Deprecated function leftover, oopsie.
<?php
/*
* YOURLS API
*
* Note about translation : this file should NOT be translation ready
* API messages and returns are supposed to be programmatically tested, so default English is expected
*
*/
define( 'YOURLS_API', true );
require_once( dirname( __FILE__ ) . '/includes/load-yourls.php' );
yourls_maybe_require_auth();
$action = ( isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null );
yourls_do_action( 'api', $action );
// Define standard API actions
$api_actions = array(
'shorturl' => 'yourls_api_action_shorturl',
'stats' => 'yourls_api_action_stats',
'db-stats' => 'yourls_api_action_db_stats',
'url-stats' => 'yourls_api_action_url_stats',
'expand' => 'yourls_api_action_expand',
'version' => 'yourls_api_action_version',
);
$api_actions = yourls_apply_filter( 'api_actions', $api_actions );
// Register API actions
foreach( (array) $api_actions as $_action => $_callback ) {
yourls_add_filter( 'api_action_' . $_action, $_callback, 99 );
}
// Try requested API method. Properly registered actions should return an array.
$return = yourls_apply_filter( 'api_action_' . $action, false );
if ( false === $return ) {
$return = array(
'errorCode' => 400,
'message' => 'Unknown or missing "action" parameter',
'simple' => 'Unknown or missing "action" parameter',
);
}
if( isset( $_REQUEST['callback'] ) )
$return['callback'] = $_REQUEST['callback'];
$format = ( isset( $_REQUEST['format'] ) ? $_REQUEST['format'] : 'xml' );
yourls_api_output( $format, $return );
die();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/changkey/YOURLS.git
[email protected]:changkey/YOURLS.git
changkey
YOURLS
YOURLS
master

搜索帮助