本文整理汇总了PHP中yourls_do_action函数的典型用法代码示例。如果您正苦于以下问题:PHP yourls_do_action函数的具体用法?PHP yourls_do_action怎么用?PHP yourls_do_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yourls_do_action函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: clayton_api_action_delete
function clayton_api_action_delete()
{
// We don't want unauthenticated users deleting links
// If YOURLS is in public mode, force authentication anyway
if (!yourls_is_private()) {
yourls_do_action('require_auth');
require_once YOURLS_INC . '/auth.php';
}
// Need 'shorturl' parameter
if (!isset($_REQUEST['shorturl'])) {
return array('statusCode' => 400, 'simple' => "Need a 'shorturl' parameter", 'message' => 'error: missing param');
}
$shorturl = $_REQUEST['shorturl'];
// Check if valid shorturl
if (!yourls_is_shorturl($shorturl)) {
return array('statusCode' => 404, 'simple ' => 'Error: short URL not found', 'message' => 'error: not found');
}
// Is $shorturl a URL (http://sho.rt/abc) or a keyword (abc) ?
if (yourls_get_protocol($shorturl)) {
$keyword = yourls_get_relative_url($shorturl);
} else {
$keyword = $shorturl;
}
// Delete shorturl
if (yourls_delete_link_by_keyword($keyword)) {
return array('statusCode' => 200, 'simple' => "Shorturl {$shorturl} deleted", 'message' => 'success: deleted');
} else {
return array('statusCode' => 500, 'simple' => 'Error: could not delete shorturl, not sure why :-/', 'message' => 'error: unknown error');
}
}
开发者ID:Gawel1,项目名称:yourls-api-delete,代码行数:30,代码来源:plugin.php
示例2: yourls_set_DB_driver
/**
* Pick the right DB class and return an instance
*
* @since 1.7
* @param string $extension Optional: user defined choice
* @return class $ydb DB class instance
*/
function yourls_set_DB_driver()
{
// Auto-pick the driver. Priority: user defined, then PDO, then mysqli, then mysql
if (defined('YOURLS_DB_DRIVER')) {
$driver = strtolower(YOURLS_DB_DRIVER);
// accept 'MySQL', 'mySQL', etc
} elseif (extension_loaded('pdo_mysql')) {
$driver = 'pdo';
} elseif (extension_loaded('mysqli')) {
$driver = 'mysqli';
} elseif (extension_loaded('mysql')) {
$driver = 'mysql';
} else {
$driver = '';
}
// Set the new driver
if (in_array($driver, array('mysql', 'mysqli', 'pdo'))) {
$class = yourls_require_db_files($driver);
}
global $ydb;
if (!class_exists($class, false)) {
$ydb = new stdClass();
yourls_die(yourls__('YOURLS requires the mysql, mysqli or pdo_mysql PHP extension. No extension found. Check your server config, or contact your host.'), yourls__('Fatal error'), 503);
}
yourls_do_action('set_DB_driver', $driver);
$ydb = new $class(YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST);
$ydb->DB_driver = $driver;
yourls_debug_log("DB driver: {$driver}");
}
开发者ID:steenhulthin,项目名称:hult.in,代码行数:36,代码来源:class-mysql.php
示例3: abdulrauf_adminreCaptcha_validatereCaptcha
function abdulrauf_adminreCaptcha_validatereCaptcha()
{
include 'captcha.php';
if ($resp != null && $resp->success) {
//reCaptcha validated
return true;
} else {
yourls_do_action('login_failed');
yourls_login_screen($error_msg = 'reCaptcha validation failed');
die;
return false;
}
}
开发者ID:armujahid,项目名称:Admin-reCaptcha,代码行数:13,代码来源:plugin.php
示例4: allow_aliases
function allow_aliases()
{
yourls_do_action('pre_get_request');
// Ignore protocol & www. prefix
$root = str_replace(array('https://', 'http://', 'https://www.', 'http://www.'), '', YOURLS_SITE);
// Use the configured domain instead of $_SERVER['HTTP_HOST']
$root_host = parse_url(YOURLS_SITE);
// Case insensitive comparison of the YOURLS root to match both http://Sho.rt/blah and http://sho.rt/blah
$request = preg_replace("!{$root}/!i", '', $root_host['host'] . $_SERVER['REQUEST_URI'], 1);
// Unless request looks like a full URL (ie request is a simple keyword) strip query string
if (!preg_match("@^[a-zA-Z]+://.+@", $request)) {
$request = current(explode('?', $request));
}
return yourls_apply_filter('get_request', $request);
}
开发者ID:NorthstarOfficial,项目名称:yourls-allow-aliases,代码行数:15,代码来源:plugin.php
示例5: yourls_is_valid_user
/**
* Check for valid user. Returns true or an error message
*
*/
function yourls_is_valid_user()
{
static $valid = false;
if ($valid) {
return true;
}
$unfiltered_valid = false;
// Logout request
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
yourls_do_action('logout');
yourls_store_cookie(null);
return yourls__('Logged out successfully');
}
// Check cookies or login request. Login form has precedence.
global $yourls_user_passwords;
yourls_do_action('pre_login');
// Determine auth method and check credentials
if (yourls_is_API() && isset($_REQUEST['timestamp']) && !empty($_REQUEST['timestamp']) && isset($_REQUEST['signature']) && !empty($_REQUEST['signature'])) {
yourls_do_action('pre_login_signature_timestamp');
$unfiltered_valid = yourls_check_signature_timestamp();
} elseif (yourls_is_API() && !isset($_REQUEST['timestamp']) && isset($_REQUEST['signature']) && !empty($_REQUEST['signature'])) {
yourls_do_action('pre_login_signature');
$unfiltered_valid = yourls_check_signature();
} elseif (isset($_REQUEST['username']) && isset($_REQUEST['password']) && !empty($_REQUEST['username']) && !empty($_REQUEST['password'])) {
yourls_do_action('pre_login_username_password');
$unfiltered_valid = yourls_check_username_password();
} elseif (!yourls_is_API() && isset($_COOKIE['yourls_username']) && isset($_COOKIE['yourls_password'])) {
yourls_do_action('pre_login_cookie');
$unfiltered_valid = yourls_check_auth_cookie();
}
$valid = yourls_apply_filter('is_valid_user', $unfiltered_valid);
// Login for the win!
if ($valid) {
yourls_do_action('login');
// (Re)store encrypted cookie if needed and tell it's ok
if (!yourls_is_API() && $unfiltered_valid) {
yourls_store_cookie(YOURLS_USER);
}
return true;
}
// Login failed
yourls_do_action('login_failed');
if (isset($_REQUEST['username']) || isset($_REQUEST['password'])) {
return yourls__('Invalid username or password');
} else {
return yourls__('Please log in');
}
}
开发者ID:GasmoN,项目名称:yourls,代码行数:52,代码来源:functions-auth.php
示例6: insensitive_get_keyword_infos
function insensitive_get_keyword_infos($keyword, $use_cache = true)
{
global $ydb;
$keyword = yourls_sanitize_string($keyword);
yourls_do_action('pre_get_keyword', $keyword, $use_cache);
if (isset($ydb->infos[$keyword]) && $use_cache == true) {
return yourls_apply_filter('get_keyword_infos', $ydb->infos[$keyword], $keyword);
}
yourls_do_action('get_keyword_not_cached', $keyword);
$table = YOURLS_DB_TABLE_URL;
$infos = $ydb->get_row("SELECT * FROM `{$table}` WHERE LOWER(`keyword`) = LOWER('{$keyword}')");
if ($infos) {
$infos = (array) $infos;
$ydb->infos[$keyword] = $infos;
} else {
$ydb->infos[$keyword] = false;
}
return yourls_apply_filter('get_keyword_infos', $ydb->infos[$keyword], $keyword);
}
开发者ID:tehMorag,项目名称:yourls-case-insensitive,代码行数:19,代码来源:plugin.php
示例7: yourls_stats_countries_map
function yourls_stats_countries_map($countries)
{
yourls_do_action('stats_countries_map');
// Echo static map. Will be hidden if JS
$map = array('cht' => 't', 'chs' => '440x220', 'chtm' => 'world', 'chco' => 'FFFFFF,88C0EB,2A85B3,1F669C', 'chld' => join('', array_keys($countries)), 'chd' => 't:' . join(',', $countries), 'chf' => 'bg,s,EAF7FE');
$map_src = 'http://chart.apis.google.com/chart?' . http_build_query($map);
echo "<img id='yourls_stat_countries_static' class='hide-if-js' src='{$map_src}' width='440' height='220' border='0' />";
// Echo dynamic map. Will be hidden if no JS
echo <<<MAP
<script type='text/javascript' src='http://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(drawMap);
function drawMap() {
var data = new google.visualization.DataTable();
MAP;
echo '
data.addRows(' . count($countries) . ');
';
echo "\n\tdata.addColumn('string', 'Country');\n\tdata.addColumn('number', 'Hits');\n\t";
$i = 0;
foreach ($countries as $c => $v) {
echo "\n\t\t data.setValue({$i}, 0, '{$c}');\n\t\t data.setValue({$i}, 1, {$v});\n\t\t";
$i++;
}
echo <<<MAP
var options = {};
options['dataMode'] = 'regions';
options['width'] = '550px';
options['height'] = '340px';
options['colors'] = [0x88C0EB,0x2A85B3,0x1F669C];
var container = document.getElementById('yourls_stat_countries');
var geomap = new google.visualization.GeoMap(container);
geomap.draw(data, options);
};
</script>
<div id="yourls_stat_countries"></div>
MAP;
}
开发者ID:469306621,项目名称:Languages,代码行数:39,代码来源:functions-infos.php
示例8: yourls_is_valid_user
<?php
// No direct call
if (!defined('YOURLS_ABSPATH')) {
die;
}
$auth = yourls_is_valid_user();
if ($auth !== true) {
// API mode,
if (yourls_is_API()) {
$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'xml';
$callback = isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '';
yourls_api_output($format, array('simple' => $auth, 'message' => $auth, 'errorCode' => 403, 'callback' => $callback));
// Regular mode
} else {
yourls_login_screen($auth);
}
die;
}
yourls_do_action('auth_successful');
开发者ID:GasmoN,项目名称:yourls,代码行数:20,代码来源:auth.php
示例9: yourls_sanitize_string
$keyword = $_GET['id'];
}
$keyword = yourls_sanitize_string($keyword);
// First possible exit:
if (!isset($keyword)) {
yourls_do_action('redirect_no_keyword');
yourls_redirect(YOURLS_SITE, 301);
}
// Get URL From Database
$url = yourls_get_keyword_longurl($keyword);
// URL found
if (!empty($url)) {
yourls_do_action('redirect_shorturl', $url, $keyword);
// Update click count in main table
$update_clicks = yourls_update_clicks($keyword);
// Update detailed log for stats
$log_redirect = yourls_log_redirect($keyword);
yourls_redirect($url, 301);
// URL not found. Either reserved, or page, or doesn't exist
} else {
// Do we have a page?
if (file_exists(YOURLS_PAGEDIR . "/{$keyword}.php")) {
yourls_page($keyword);
// Either reserved id, or no such id
} else {
yourls_do_action('redirect_keyword_not_found', $keyword);
yourls_redirect(YOURLS_SITE, 302);
// no 404 to tell browser this might change, and also to not pollute logs
}
}
exit;
开发者ID:steenhulthin,项目名称:hult.in,代码行数:31,代码来源:yourls-go.php
示例10: throw
try {
throw ('ozhismygod');
} catch (z) {
a = function () {
if (!w.open(u,'Share','width=450,height=450,left=430','_blank')) l = u;
};
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
else a();
}
void(0);
TUMBLR;
yourls_bookmarklet_link(yourls_make_bookmarklet($js_code), yourls__('YOURLS & Tumblr'));
?>
<?php
yourls_do_action('social_bookmarklet_buttons_after');
?>
</p>
<h2><?php
yourls_e('Prefix-n-Shorten');
?>
</h2>
<p><?php
yourls_se("When viewing a page, you can also prefix its full URL: just head to your browser's address bar, add \"<span>%s</span>\" to the beginning of the current URL (right before its 'http://' part) and hit enter.", preg_replace('@https?://@', '', YOURLS_SITE) . '/');
?>
</p>
<p><?php
开发者ID:Steadroy,项目名称:YOURLS,代码行数:31,代码来源:tools.php
示例11: yourls_plugin_admin_page
/**
* Handle plugin administration page
*
*/
function yourls_plugin_admin_page($plugin_page)
{
global $ydb;
// Check the plugin page is actually registered
if (!isset($ydb->plugin_pages[$plugin_page])) {
yourls_die('This page does not exist. Maybe a plugin you thought was activated is inactive?', 'Invalid link');
}
// Draw the page itself
yourls_do_action('load-' . $plugin_page);
yourls_html_head('plugin_page_' . $plugin_page, $ydb->plugin_pages[$plugin_page]['title']);
yourls_html_logo();
yourls_html_menu();
call_user_func($ydb->plugin_pages[$plugin_page]['function']);
yourls_html_footer();
die;
}
开发者ID:469306621,项目名称:Languages,代码行数:20,代码来源:functions-plugins.php
示例12: isset
if (preg_match("@^([{$pattern}]+)/?\$@", $request, $matches)) {
$keyword = isset($matches[1]) ? $matches[1] : '';
$keyword = yourls_sanitize_keyword($keyword);
yourls_do_action('load_template_go', $keyword);
require_once YOURLS_ABSPATH . '/yourls-go.php';
exit;
}
// Stats:
if (preg_match("@^([{$pattern}]+)\\+(all)?/?\$@", $request, $matches)) {
$keyword = isset($matches[1]) ? $matches[1] : '';
$keyword = yourls_sanitize_keyword($keyword);
$aggregate = isset($matches[2]) ? (bool) $matches[2] && yourls_allow_duplicate_longurls() : false;
yourls_do_action('load_template_infos', $keyword);
require_once YOURLS_ABSPATH . '/yourls-infos.php';
exit;
}
// Prefix-n-Shorten sends to bookmarklet (doesn't work on Windows)
if (preg_match("@^[a-zA-Z]+://.+@", $request, $matches)) {
$url = yourls_sanitize_url($matches[0]);
if ($parse = yourls_get_protocol_slashes_and_rest($url, array('up', 'us', 'ur'))) {
yourls_do_action('load_template_redirect_admin', $url);
$parse = array_map('rawurlencode', $parse);
// Redirect to /admin/index.php?up=<url protocol>&us=<url slashes>&ur=<url rest>
yourls_redirect(yourls_add_query_arg($parse, yourls_admin_url('index.php')), 302);
exit;
}
}
// Past this point this is a request the loader could not understand
yourls_do_action('loader_failed', $request);
yourls_redirect(YOURLS_SITE, 302);
exit;
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:31,代码来源:yourls-loader.php
示例13: yourls_do_action
yourls_do_action('infos_no_keyword');
yourls_redirect(YOURLS_SITE, 302);
}
// Get basic infos for this shortened URL
$keyword = yourls_sanitize_string($keyword);
$longurl = yourls_get_keyword_longurl($keyword);
$clicks = yourls_get_keyword_clicks($keyword);
$timestamp = yourls_get_keyword_timestamp($keyword);
$title = yourls_get_keyword_title($keyword);
// Update title if it hasn't been stored yet
if ($title == '') {
$title = yourls_get_remote_title($longurl);
yourls_edit_link_title($keyword, $title);
}
if ($longurl === false) {
yourls_do_action('infos_keyword_not_found');
yourls_redirect(YOURLS_SITE, 302);
}
if (yourls_do_log_redirect()) {
// Duplicate keywords, if applicable
$keyword_list = yourls_get_duplicate_keywords($longurl);
// Fetch all information from the table log
$table = YOURLS_DB_TABLE_LOG;
if ($aggregate) {
$keywords = join("', '", $keyword_list);
// Fetch information for all keywords pointing to $longurl
$hits = $ydb->get_results("SELECT `shorturl`, `click_time`, `referrer`, `user_agent`, `country_code` FROM `{$table}` WHERE `shorturl` IN ( '{$keywords}' );");
} else {
// Fetch information for current keyword only
$hits = $ydb->get_results("SELECT `click_time`, `referrer`, `user_agent`, `country_code` FROM `{$table}` WHERE `shorturl` = '{$keyword}';");
}
开发者ID:TheProjecter,项目名称:yourls-ext,代码行数:31,代码来源:yourls-infos.php
示例14: yourls_check_IP_flood
function yourls_check_IP_flood($ip = '')
{
yourls_do_action('pre_check_ip_flood', $ip);
// at this point $ip can be '', check it if your plugin hooks in here
if (defined('YOURLS_FLOOD_DELAY_SECONDS') && YOURLS_FLOOD_DELAY_SECONDS === 0 || !defined('YOURLS_FLOOD_DELAY_SECONDS')) {
return true;
}
$ip = $ip ? yourls_sanitize_ip($ip) : yourls_get_IP();
// Don't throttle whitelist IPs
if (defined('YOURLS_FLOOD_IP_WHITELIST' && YOURLS_FLOOD_IP_WHITELIST)) {
$whitelist_ips = explode(',', YOURLS_FLOOD_IP_WHITELIST);
foreach ((array) $whitelist_ips as $whitelist_ip) {
$whitelist_ip = trim($whitelist_ip);
if ($whitelist_ip == $ip) {
return true;
}
}
}
// Don't throttle logged in users
if (yourls_is_private()) {
if (yourls_is_valid_user() === true) {
return true;
}
}
yourls_do_action('check_ip_flood', $ip);
global $ydb;
$table = YOURLS_DB_TABLE_URL;
$lasttime = $ydb->get_var("SELECT `timestamp` FROM {$table} WHERE `ip` = '{$ip}' ORDER BY `timestamp` DESC LIMIT 1");
if ($lasttime) {
$now = date('U');
$then = date('U', strtotime($lasttime));
if ($now - $then <= YOURLS_FLOOD_DELAY_SECONDS) {
// Flood!
yourls_do_action('ip_flood', $ip, $now - $then);
yourls_die('Too many URLs added too fast. Slow down please.', 'Forbidden', 403);
}
}
return true;
}
开发者ID:TheProjecter,项目名称:yourls-ext,代码行数:39,代码来源:functions.php
示例15: yourls_content_type_header
/**
* Send a filerable content type header
*
* @since 1.7
* @param string $type content type ('text/html', 'application/json', ...)
* @return bool whether header was sent
*/
function yourls_content_type_header($type)
{
yourls_do_action('content_type_header', $type);
if (!headers_sent()) {
$charset = yourls_apply_filter('content_type_header_charset', 'utf-8');
header("Content-Type: {$type}; charset={$charset}");
return true;
}
return false;
}
开发者ID:yourls,项目名称:yourls,代码行数:17,代码来源:functions-html.php
示例16: yourls_db_connect
yourls_db_connect();
}
// Allow early inclusion of a cache layer
if (file_exists(YOURLS_USERDIR . '/cache.php')) {
require_once YOURLS_USERDIR . '/cache.php';
}
// Read options right from start
yourls_get_all_options();
// Register shutdown function
register_shutdown_function('yourls_shutdown');
// Core now loaded
yourls_do_action('init');
// plugins can't see this, not loaded yet
// Check if need to redirect to install procedure
if (!yourls_is_installed() && !yourls_is_installing()) {
yourls_redirect(yourls_admin_url('install.php'), 302);
}
// Check if upgrade is needed (bypassed if upgrading or installing)
if (!yourls_is_upgrading() && !yourls_is_installing()) {
if (yourls_upgrade_is_needed()) {
yourls_redirect(YOURLS_SITE . '/admin/upgrade.php', 302);
}
}
// Init all plugins
yourls_load_plugins();
yourls_do_action('plugins_loaded');
// Is there a new version of YOURLS ?
yourls_new_core_version_notice();
if (yourls_is_admin()) {
yourls_do_action('admin_init');
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:31,代码来源:load-yourls.php
示例17: yourls_stats_line
/**
* Echoes an image tag of Google Charts line graph from array of values (eg 'number of clicks').
*
* $legend1_list & legend2_list are values used for the 2 x-axis labels. $id is an HTML/JS id
*
*/
function yourls_stats_line($values, $id = null)
{
yourls_do_action('pre_stats_line');
// if $id is null then assign a random string
if ($id === null) {
$id = uniqid('yourls_stats_line_');
}
// If we have only 1 day of data, prepend a fake day with 0 hits for a prettier graph
if (count($values) == 1) {
array_unshift($values, 0);
}
// Keep only a subset of values to keep graph smooth
$values = yourls_array_granularity($values, 30);
$data = array_merge(array('Time' => 'Hits'), $values);
$data = yourls_google_array_to_data_table($data);
$options = array("legend" => "none", "pointSize" => "3", "theme" => "maximized", "curveType" => "function", "width" => 430, "height" => 220, "hAxis" => "{minTextSpacing: 80, maxTextLines: 1, maxAlternation: 1}", "vAxis" => "{minValue: -0.5, format: '#'}", "colors" => "['#2a85b3']");
$options = yourls_apply_filter('stats_line_options', $options);
$lineChart = yourls_google_viz_code('LineChart', $data, $options, $id);
echo yourls_apply_filter('stats_line', $lineChart, $values, $options, $id);
}
开发者ID:chadcumm,项目名称:YOURLS,代码行数:26,代码来源:functions-infos.php
示例18: yourls_html_tfooter
yourls_html_tfooter($params);
}
yourls_table_tbody_start();
// Main Query
$where = yourls_apply_filter('admin_list_where', $where);
$url_results = $ydb->get_results("SELECT * FROM `{$table_url}` WHERE 1=1 {$where} ORDER BY `{$sort_by}` {$sort_order} LIMIT {$offset}, {$perpage};");
$found_rows = false;
if ($url_results) {
$found_rows = true;
foreach ($url_results as $url_result) {
$keyword = yourls_sanitize_string($url_result->keyword);
$timestamp = strtotime($url_result->timestamp);
$url = stripslashes($url_result->url);
$ip = $url_result->ip;
$title = $url_result->title ? $url_result->title : '';
$clicks = $url_result->clicks;
echo yourls_table_add_row($keyword, $url, $title, $ip, $clicks, $timestamp);
}
}
$display = $found_rows ? 'display:none' : '';
echo '<tr id="nourl_found" style="' . $display . '"><td colspan="6">' . yourls__('No URL') . '</td></tr>';
yourls_table_tbody_end();
yourls_table_end();
yourls_do_action('admin_page_after_table');
if ($is_bookmark) {
yourls_share_box($url, $return['shorturl'], $title, $text);
}
?>
<?php
yourls_html_footer();
开发者ID:yourls,项目名称:yourls,代码行数:31,代码来源:index.php
示例19: yourls_api_output
/**
* Output and return API result
*
* This function will echo (or only return if asked) an array as JSON, JSONP or XML. If the array has a
* 'simple' key, it can also output that key as unformatted text if expected output mode is 'simple'
*
* Most likely, script should not do anything after outputting this
*
* @since 1.6
*
* @param string $mode Expected output mode ('json', 'jsonp', 'xml', 'simple')
* @param array $output Array of things to output
* @param bool $send_headers Optional, default true: Whether a headers (status, content type) should be sent or not
* @param bool $echo Optional, default true: Whether the output should be outputted or just returned
* @return string API output, as an XML / JSON / JSONP / raw text string
*/
function yourls_api_output($mode, $output, $send_headers = true, $echo = true)
{
if (isset($output['simple'])) {
$simple = $output['simple'];
unset($output['simple']);
}
yourls_do_action('pre_api_output', $mode, $output, $send_headers, $echo);
if ($send_headers) {
if (isset($output['statusCode'])) {
$code = $output['statusCode'];
} elseif (isset($output['errorCode'])) {
$code = $output['errorCode'];
} else {
$code = 200;
}
yourls_status_header($code);
}
$result = '';
switch ($mode) {
case 'jsonp':
if ($send_headers) {
yourls_content_type_header('application/javascript');
}
$callback = isset($output['callback']) ? $output['callback'] : '';
$result = $callback . '(' . json_encode($output) . ')';
break;
case 'json':
if ($send_headers) {
yourls_content_type_header('application/json');
}
$result = json_encode($output);
break;
case 'xml':
if ($send_headers) {
yourls_content_type_header('application/xml');
}
$result = yourls_xml_encode($output);
break;
case 'simple':
default:
if ($send_headers) {
yourls_content_type_header('text/plain');
}
$result = isset($simple) ? $simple : '';
break;
}
if ($echo) {
echo $result;
}
yourls_do_action('api_output', $mode, $output, $send_headers, $echo);
return $result;
}
开发者ID:idemirel,项目名称:YOURLS-Password-Protected-Links,代码行数:68,代码来源:functions-api.php
示例20: yourls_page
/**
* Display a page
*
*/
function yourls_page($page)
{
$include = YOURLS_ABSPATH . "/pages/{$page}.php";
if (!file_exists($include)) {
yourls_die("Page '{$page}' not found", 'Not found', 404);
}
yourls_do_action('pre_page', $page);
include_once $include;
yourls_do_action('post_page', $page);
die;
}
开发者ID:mimischi,项目名称:gu-urlshorter,代码行数:15,代码来源:functions-html.php
注:本文中的yourls_do_action函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论