本文整理汇总了PHP中JSON类的典型用法代码示例。如果您正苦于以下问题:PHP JSON类的具体用法?PHP JSON怎么用?PHP JSON使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSON类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ajax
/**
* @param Doku_Event$event
* @param $param
*/
public function ajax(Doku_Event $event, $param)
{
if ($event->data !== 'bureaucracy_user_field') {
return;
}
$event->stopPropagation();
$event->preventDefault();
$search = $_REQUEST['search'];
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
$users = array();
foreach ($auth->retrieveUsers() as $username => $data) {
if ($search === '' || stripos($username, $search) === 0 || stripos($data['name'], $search) !== false) {
// Full name
$users[$username] = $data['name'];
}
if (count($users) === 10) {
break;
}
}
if (count($users) === 1 && key($users) === $search) {
$users = array();
}
require_once DOKU_INC . 'inc/JSON.php';
$json = new JSON();
echo $json->encode($users);
}
开发者ID:rusidea,项目名称:analitika,代码行数:31,代码来源:action.php
示例2: handle_ajax_call
function handle_ajax_call(&$event, $param)
{
if ($event->data == 'plugin_do') {
$id = cleanID($_REQUEST['do_page']);
if (auth_quickaclcheck($id) < AUTH_EDIT) {
echo -1;
$event->preventDefault();
$event->stopPropagation();
return false;
}
// toggle status of a single task
$hlp = plugin_load('helper', 'do');
$status = $hlp->toggleTaskStatus($id, $_REQUEST['do_md5'], $_REQUEST['do_commit']);
// rerender the page
p_get_metadata(cleanID($_REQUEST['do_page']), '', true);
header('Content-Type: text/plain; charset=utf-8');
echo $status;
$event->preventDefault();
$event->stopPropagation();
return false;
} elseif ($event->data == 'plugin_do_status') {
// read status for a bunch of tasks
require_once DOKU_INC . 'inc/JSON.php';
$JSON = new JSON();
$hlp = plugin_load('helper', 'do');
$status = $hlp->getAllPageStatuses(cleanID($_REQUEST['do_page']));
$status = $JSON->encode($status);
header('Content-Type: text/plain; charset=utf-8');
echo $status;
$event->preventDefault();
$event->stopPropagation();
return false;
}
return true;
}
开发者ID:rauschen,项目名称:do,代码行数:35,代码来源:action.php
示例3: setUserSetting
/**
* Remotely set a user setting.
* @param $args array
* @param $request PKPRequest
* @return string a JSON message
*/
function setUserSetting($args, &$request)
{
// Retrieve the user from the session.
$user =& $request->getUser();
assert(is_a($user, 'User'));
// Exit with an error if request parameters are missing.
if (!isset($args['setting-name']) && isset($args['setting-value'])) {
$json = new JSON('false', 'Required request parameter "setting-name" or "setting-value" missing!');
return $json->getString();
}
// Validate the setting.
$settingName = $args['setting-name'];
$settingValue = $args['setting-value'];
$settingType = $this->_settingType($settingName);
switch ($settingType) {
case 'bool':
if (!($settingValue === 'false' || $settingValue === 'true')) {
$json = new JSON('false', 'Invalid setting value! Must be "true" or "false".');
return $json->getString();
}
$settingValue = $settingValue === 'true' ? true : false;
break;
default:
// Exit with a fatal error when an unknown setting is found.
$json = new JSON('false', 'Unknown setting!');
return $json->getString();
}
// Persist the validated setting.
$userSettingsDAO =& DAORegistry::getDAO('UserSettingsDAO');
$userSettingsDAO->updateSetting($user->getId(), $settingName, $settingValue, $settingType);
// Return a success message.
$json = new JSON('true');
return $json->getString();
}
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:40,代码来源:UserApiHandler.inc.php
示例4: _ajax_call
/**
* Register the events
*
* @param $event DOKU event on ajax call
* @param $param parameters, ignored
*/
function _ajax_call(&$event, $param)
{
if ($event->data !== 'plugin_explorertree') {
return;
}
//no other ajax call handlers needed
$event->stopPropagation();
$event->preventDefault();
//e.g. access additional request variables
global $INPUT;
//available since release 2012-10-13 "Adora Belle"
if (!checkSecurityToken()) {
$data = array('error' => true, 'msg' => 'invalid security token!');
} else {
switch ($INPUT->str('operation')) {
case 'explorertree_branch':
if (!($helper = plugin_load('helper', 'explorertree'))) {
$data = array('error' => true, 'msg' => "Can't load tree helper.");
break;
}
if (!($route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader')))) {
$data = array('error' => true, 'msg' => "Can't load route '" . $INPUT->str('route') . "'!");
}
$data = array('html' => $helper->htmlExplorer($INPUT->str('route'), ltrim(':' . $INPUT->str('itemid')), ':'));
if (!$data['html']) {
$data['error'] = true;
$data['msg'] = "Can't load tree html.";
}
break;
case 'callback':
if (!($helper = plugin_load('helper', 'explorertree'))) {
$data = array('error' => true, 'msg' => "Can't load tree helper.");
break;
}
$route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader'));
if (!$route || !is_callable(@$route['callbacks'][$INPUT->str(event)])) {
$data = array('error' => true, 'msg' => "Can't load callback '" . $INPUT->str('event') . "'for '" . $INPUT->str('route') . "'!");
}
$data = @call_user_func_array($route['callbacks'][$INPUT->str(event)], array($INPUT->str('itemid')));
if (!is_array($data)) {
$data = array('error' => true, 'msg' => "Callback for '" . $INPUT->str('event') . "' does not exists!");
}
break;
default:
$data = array('error' => true, 'msg' => 'Unknown operation: ' . $INPUT->str('operation'));
break;
}
//data
//json library of DokuWiki
}
if (is_array($data)) {
$data['token'] = getSecurityToken();
}
require_once DOKU_INC . 'inc/JSON.php';
$json = new JSON();
//set content type
header('Content-Type: application/json');
echo $json->encode($data);
// $this->get_helper()->check_meta_changes();
}
开发者ID:Klap-in,项目名称:explorertree,代码行数:66,代码来源:action.php
示例5: js_out
/**
* Output all needed JavaScript
*
* @author Andreas Gohr <[email protected]>
*/
function js_out()
{
global $conf;
global $lang;
global $config_cascade;
// The generated script depends on some dynamic options
$cache = new cache('scripts' . $_SERVER['HTTP_HOST'] . $_SERVER['SERVER_PORT'], '.js');
$cache->_event = 'JS_CACHE_USE';
// load minified version for some files
$min = $conf['compress'] ? '.min' : '';
// array of core files
$files = array(DOKU_INC . "lib/scripts/jquery/jquery{$min}.js", DOKU_INC . 'lib/scripts/jquery/jquery.cookie.js', DOKU_INC . "lib/scripts/jquery/jquery-ui{$min}.js", DOKU_INC . "lib/scripts/fileuploader.js", DOKU_INC . "lib/scripts/fileuploaderextended.js", DOKU_INC . 'lib/scripts/helpers.js', DOKU_INC . 'lib/scripts/delay.js', DOKU_INC . 'lib/scripts/cookie.js', DOKU_INC . 'lib/scripts/script.js', DOKU_INC . 'lib/scripts/tw-sack.js', DOKU_INC . 'lib/scripts/qsearch.js', DOKU_INC . 'lib/scripts/tree.js', DOKU_INC . 'lib/scripts/index.js', DOKU_INC . 'lib/scripts/drag.js', DOKU_INC . 'lib/scripts/textselection.js', DOKU_INC . 'lib/scripts/toolbar.js', DOKU_INC . 'lib/scripts/edit.js', DOKU_INC . 'lib/scripts/editor.js', DOKU_INC . 'lib/scripts/locktimer.js', DOKU_INC . 'lib/scripts/linkwiz.js', DOKU_INC . 'lib/scripts/media.js', DOKU_INC . 'lib/scripts/compatibility.js', DOKU_INC . 'lib/scripts/behaviour.js', DOKU_INC . 'lib/scripts/page.js', tpl_incdir() . 'script.js');
// add possible plugin scripts and userscript
$files = array_merge($files, js_pluginscripts());
if (isset($config_cascade['userscript']['default'])) {
$files[] = $config_cascade['userscript']['default'];
}
$cache_files = array_merge($files, getConfigFiles('main'));
$cache_files[] = __FILE__;
// check cache age & handle conditional request
// This may exit if a cache can be used
$cache_ok = $cache->useCache(array('files' => $cache_files));
http_cached($cache->cache, $cache_ok);
// start output buffering and build the script
ob_start();
// add some global variables
print "var DOKU_BASE = '" . DOKU_BASE . "';";
print "var DOKU_TPL = '" . tpl_basedir() . "';";
// FIXME: Move those to JSINFO
print "var DOKU_UHN = " . (int) useHeading('navigation') . ";";
print "var DOKU_UHC = " . (int) useHeading('content') . ";";
// load JS specific translations
$json = new JSON();
$lang['js']['plugins'] = js_pluginstrings();
echo 'LANG = ' . $json->encode($lang['js']) . ";\n";
// load toolbar
toolbar_JSdefines('toolbar');
// load files
foreach ($files as $file) {
echo "\n\n/* XXXXXXXXXX begin of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
js_load($file);
echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n";
}
// init stuff
if ($conf['locktime'] != 0) {
js_runonstart("dw_locktimer.init(" . ($conf['locktime'] - 60) . "," . $conf['usedraft'] . ")");
}
// init hotkeys - must have been done after init of toolbar
# disabled for FS#1958 js_runonstart('initializeHotkeys()');
// end output buffering and get contents
$js = ob_get_contents();
ob_end_clean();
// compress whitespace and comments
if ($conf['compress']) {
$js = js_compress($js);
}
$js .= "\n";
// https://bugzilla.mozilla.org/show_bug.cgi?id=316033
http_cached_finish($cache->cache, $js);
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:65,代码来源:js.php
示例6: handle_ajax
/**
* Rename a single page
*/
public function handle_ajax(Doku_Event $event)
{
if ($event->data != 'plugin_move_rename') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $MSG;
global $INPUT;
$src = cleanID($INPUT->str('id'));
$dst = cleanID($INPUT->str('newid'));
/** @var helper_plugin_move_op $MoveOperator */
$MoveOperator = plugin_load('helper', 'move_op');
$JSON = new JSON();
header('Content-Type: application/json');
if ($this->renameOkay($src) && $MoveOperator->movePage($src, $dst)) {
// all went well, redirect
echo $JSON->encode(array('redirect_url' => wl($dst, '', true, '&')));
} else {
if (isset($MSG[0])) {
$error = $MSG[0];
// first error
} else {
$error = $this->getLang('cantrename');
}
echo $JSON->encode(array('error' => $error));
}
}
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:31,代码来源:rename.php
示例7: exchange_shop_license
/**
* 功能:与 ECShop 交换数据
*
* @param array $certi 登录参数
* @param array $license 网店license信息
* @param bool $use_lib 使用哪一个json库,0为ec,1为shopex
* @return array
*/
function exchange_shop_license($certi, $license, $use_lib = 0)
{
if (!is_array($certi)) {
return array();
}
include_once ROOT_PATH . 'includes/cls_transport.php';
include_once ROOT_PATH . 'includes/cls_json.php';
$params = '';
foreach ($certi as $key => $value) {
$params .= '&' . $key . '=' . $value;
}
$params = trim($params, '&');
$transport = new transport();
//$transport->connect_timeout = 1;
$request = $transport->request($license['certi'], $params, 'POST');
$request_str = json_str_iconv($request['body']);
if (empty($use_lib)) {
$json = new JSON();
$request_arr = $json->decode($request_str, 1);
} else {
include_once ROOT_PATH . 'includes/shopex_json.php';
$request_arr = json_decode($request_str, 1);
}
return $request_arr;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:33,代码来源:lib_license.php
示例8: handle_ajax
/**
* Step up
*
* @param Doku_Event $event
*/
public function handle_ajax(Doku_Event $event)
{
if ($event->data != 'plugin_move_progress') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $INPUT;
global $USERINFO;
if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
http_status(403);
exit;
}
$return = array('error' => '', 'complete' => false, 'progress' => 0);
/** @var helper_plugin_move_plan $plan */
$plan = plugin_load('helper', 'move_plan');
if (!$plan->isCommited()) {
// There is no plan. Something went wrong
$return['complete'] = true;
} else {
$todo = $plan->nextStep($INPUT->bool('skip'));
$return['progress'] = $plan->getProgress();
$return['error'] = $plan->getLastError();
if ($todo === 0) {
$return['complete'] = true;
}
}
$json = new JSON();
header('Content-Type: application/json');
echo $json->encode($return);
}
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:36,代码来源:progress.php
示例9: verifyReturn
/**
* 针对return_url验证消息是否是连连支付发出的合法消息
* @return 验证结果
*/
function verifyReturn()
{
if (empty($_POST)) {
//判断POST来的数组是否为空
return false;
} else {
$res_data = $_POST["res_data"];
// file_put_contents("log.txt", "返回结果:" . $res_data . "\n", FILE_APPEND);
$json = new JSON();
//error_reporting(3);
//商户编号
$oid_partner = $json->decode($res_data)->{'oid_partner'};
//首先对获得的商户号进行比对
if (trim($oid_partner) != $this->llpay_config['oid_partner']) {
//商户号错误
return false;
}
//生成签名结果
$parameter = array('oid_partner' => $oid_partner, 'sign_type' => $json->decode($res_data)->{'sign_type'}, 'dt_order' => $json->decode($res_data)->{'dt_order'}, 'no_order' => $json->decode($res_data)->{'no_order'}, 'oid_paybill' => $json->decode($res_data)->{'oid_paybill'}, 'money_order' => $json->decode($res_data)->{'money_order'}, 'result_pay' => $json->decode($res_data)->{'result_pay'}, 'settle_date' => $json->decode($res_data)->{'settle_date'}, 'info_order' => $json->decode($res_data)->{'info_order'}, 'pay_type' => $json->decode($res_data)->{'pay_type'}, 'bank_code' => $json->decode($res_data)->{'bank_code'});
if (!$this->getSignVeryfy($parameter, $json->decode($res_data)->{'sign'})) {
return false;
}
return true;
}
}
开发者ID:suyuanen,项目名称:p2p,代码行数:29,代码来源:LLpayNotify.php
示例10: testDecoding
public function testDecoding()
{
$formatter = new JSON();
$data = (object) array('name' => 'Joe', 'age' => 21, 'employed' => true);
$raw = '{"name":"Joe","age":21,"employed":true}';
$this->assertEquals($data, $formatter->decode($raw));
}
开发者ID:gekt,项目名称:www,代码行数:7,代码来源:JSONTest.php
示例11: deleteFile
/**
* Delete a file or revision
* @param $args array
* @param $request Request
* @return string a serialized JSON object
*/
function deleteFile($args, &$request)
{
// FIXME: authorize!
$fileId = (int) $request->getUserVar('fileId');
$success = false;
if ($fileId) {
// Delete all revisions or only one?
$revision = $request->getUserVar('revision') ? (int) $request->getUserVar('revision') : null;
// Delete the file/revision but only when it belongs to the authorized monograph
// and to the right file stage.
$monograph =& $this->getMonograph();
$submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
if ($revision) {
$success = (bool) $submissionFileDao->deleteRevisionById($fileId, $revision, $this->getFileStage(), $monograph->getId());
} else {
$success = (bool) $submissionFileDao->deleteAllRevisionsById($fileId, $this->getFileStage(), $monograph->getId());
}
}
if ($success) {
return DAO::getDataChangedEvent($fileId);
} else {
$json = new JSON(false);
return $json->getString();
}
}
开发者ID:jerico-dev,项目名称:omp,代码行数:32,代码来源:FileApiHandler.inc.php
示例12: output
function output($data)
{
header("Content-Type:text/html; charset=utf-8");
$r_type = intval($_REQUEST['r_type']);
//返回数据格式类型; 0:base64;1;json_encode;2:array
$data['act'] = ACT;
$data['act_2'] = ACT_2;
sql_check("wap");
if ($r_type == 0) {
require_once APP_ROOT_PATH . 'system/libs/json.php';
$JSON = new JSON();
print_r(base64_encode($JSON->encode($data)));
// echo base64_encode(json_encode($data));
} else {
if ($r_type == 1) {
//echo APP_ROOT_PATH; exit;
require_once APP_ROOT_PATH . 'system/libs/json.php';
//echo 'ss';exit;
$JSON = new JSON();
print_r($JSON->encode($data));
//print_r(json_encode($data));
} else {
if ($r_type == 2) {
print_r($data);
}
}
}
exit;
}
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:29,代码来源:functions.php
示例13: verifyNotify
/**
* 针对notify_url验证消息是否是连连支付发出的合法消息
* @return 验证结果
*/
function verifyNotify()
{
//生成签名结果
$is_notify = true;
include_once 'llpay_cls_json.php';
$json = new JSON();
$str = file_get_contents("php://input");
$val = $json->decode($str);
$oid_partner = trim($val->{'oid_partner'});
$sign_type = trim($val->{'sign_type'});
$sign = trim($val->{'sign'});
$dt_order = trim($val->{'dt_order'});
$no_order = trim($val->{'no_order'});
$oid_paybill = trim($val->{'oid_paybill'});
$money_order = trim($val->{'money_order'});
$result_pay = trim($val->{'result_pay'});
$settle_date = trim($val->{'settle_date'});
$info_order = trim($val->{'info_order'});
$pay_type = trim($val->{'pay_type'});
$bank_code = trim($val->{'bank_code'});
$no_agree = trim($val->{'no_agree'});
$id_type = trim($val->{'id_type'});
$id_no = trim($val->{'id_no'});
$acct_name = trim($val->{'acct_name'});
//首先对获得的商户号进行比对
if ($oid_partner != $this->llpay_config['oid_partner']) {
//商户号错误
return false;
}
$parameter = array('oid_partner' => $oid_partner, 'sign_type' => $sign_type, 'dt_order' => $dt_order, 'no_order' => $no_order, 'oid_paybill' => $oid_paybill, 'money_order' => $money_order, 'result_pay' => $result_pay, 'settle_date' => $settle_date, 'info_order' => $info_order, 'pay_type' => $pay_type, 'bank_code' => $bank_code, 'no_agree' => $no_agree, 'id_type' => $id_type, 'id_no' => $id_no, 'acct_name' => $acct_name);
if (!$this->getSignVeryfy($parameter, $sign)) {
return false;
}
return true;
}
开发者ID:jiumogaoao,项目名称:xz,代码行数:39,代码来源:llpay_notify.class.php
示例14: __register_template
function __register_template()
{
global $conf;
if (!empty($_REQUEST['q'])) {
require_once DOKU_INC . 'inc/JSON.php';
$json = new JSON();
$tempREQUEST = (array) $json->dec(stripslashes($_REQUEST['q']));
} else {
if (!empty($_REQUEST['template'])) {
$tempREQUEST = $_REQUEST;
} else {
if (preg_match("/(js|css)\\.php\$/", $_SERVER['SCRIPT_NAME']) && isset($_SERVER['HTTP_REFERER'])) {
// this is a css or script, nothing before matched and we have a referrer.
// lets asume we came from the dokuwiki page.
// Parse the Referrer URL
$url = parse_url($_SERVER['HTTP_REFERER']);
parse_str($url['query'], $tempREQUEST);
} else {
return;
}
}
}
// define Template baseURL
if (empty($tempREQUEST['template'])) {
return;
}
$tplDir = DOKU_INC . 'lib/tpl/' . $tempREQUEST['template'] . '/';
if (!file_exists($tplDir)) {
return;
}
// Set hint for Dokuwiki_Started event
if (!defined('SITEEXPORT_TPL')) {
define('SITEEXPORT_TPL', $tempREQUEST['template']);
}
// define baseURL
// This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
/* **************************************************************************************** */
if (!defined('DOKU_REL')) {
define('DOKU_REL', getBaseURL(false));
}
if (!defined('DOKU_URL')) {
define('DOKU_URL', getBaseURL(true));
}
if (!defined('DOKU_BASE')) {
if (isset($conf['canonical'])) {
define('DOKU_BASE', DOKU_URL);
} else {
define('DOKU_BASE', DOKU_REL);
}
}
// This should be DEPRECATED - as it is in init.php which suggest tpl_basedir and tpl_incdir
if (!defined('DOKU_TPL')) {
define('DOKU_TPL', (empty($tempREQUEST['base']) ? DOKU_BASE : $tempREQUEST['base']) . 'lib/tpl/' . $tempREQUEST['template'] . '/');
}
if (!defined('DOKU_TPLINC')) {
define('DOKU_TPLINC', $tplDir);
}
/* **************************************************************************************** */
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:59,代码来源:preload.php
示例15: array
/**
* Pass in a JSON object to return it back as
* an associative array
* @param JSON $json
*/
public static function &jsonToArray(JSON $json)
{
$array = array();
for ($i = 0; $json->getCount() > $i; $i++) {
$item = $json->itemAt($i);
$array[$item->getProperty()] = $item->getValue();
}
return $array;
}
开发者ID:quantrocket,项目名称:planlogiq,代码行数:14,代码来源:JSONUtil.php
示例16: authorstatsReadJSON
function authorstatsReadJSON()
{
$json = new JSON(JSON_LOOSE_TYPE);
$file = @file_get_contents(DOKU_PLUGIN . "authorstats/authorstats.json");
if (!$file) {
return array();
}
return $json->decode($file);
}
开发者ID:Laurent3170,项目名称:dokuwiki-plugin-authorstats,代码行数:9,代码来源:helpers.php
示例17: loadCBData
/**
* Read config
*
* @return bool|mixed
*/
protected function loadCBData()
{
$json = new JSON(JSON_LOOSE_TYPE);
$file = @file_get_contents(DOKU_PLUGIN . "custombuttons/config.json");
if (!$file) {
return false;
}
return $json->decode($file);
}
开发者ID:alexgearbox,项目名称:dokuwiki-plugin-custombuttons,代码行数:14,代码来源:admin.php
示例18: showpageafterlogin_read_json
function showpageafterlogin_read_json()
{
$json = new JSON(JSON_LOOSE_TYPE);
$file = @file_get_contents(DOKU_PLUGIN . "showpageafterlogin/showpageafterlogincount.json");
if (!$file) {
return array();
}
return $json->decode($file);
}
开发者ID:s-blu,项目名称:showpageafterlogin,代码行数:9,代码来源:action.php
示例19: selectFiles
/**
* Show the form to allow the user to select review files
* (bring in/take out files from submission stage to review stage)
*
* FIXME: Move to it's own handler so that it can be re-used among grids.
*
* @param $args array
* @param $request PKPRequest
* @return string Serialized JSON object
*/
function selectFiles($args, &$request)
{
$monograph =& $this->getMonograph();
import('controllers.grid.files.review.form.ManageReviewFilesForm');
$manageReviewFilesForm = new ManageReviewFilesForm($monograph->getId(), $this->getRequestArg('reviewType'), $this->getRequestArg('round'));
$manageReviewFilesForm->initData($args, $request);
$json = new JSON(true, $manageReviewFilesForm->fetch($request));
return $json->getString();
}
开发者ID:jerico-dev,项目名称:omp,代码行数:19,代码来源:EditorReviewFilesGridHandler.inc.php
示例20: getUser
/**
* Retrieve the user's data
*
* The array needs to contain at least 'user', 'mail', 'name' and optional 'grps'
*
* @return array
*/
public function getUser()
{
$JSON = new \JSON(JSON_LOOSE_TYPE);
$data = array();
$result = $JSON->decode($this->oAuth->request('https://kelder.zeus.ugent.be/oauth/api/current_user?format=json'));
$data['user'] = $result['username'];
$data['name'] = $result['username'];
$data['mail'] = $result['username'] . '@zeus.ugent.be';
return $data;
}
开发者ID:ZeusWPI,项目名称:dokuwiki-plugin-oauth,代码行数:17,代码来源:ZeusAdapter.php
注:本文中的JSON类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论