本文整理汇总了PHP中api类的典型用法代码示例。如果您正苦于以下问题:PHP api类的具体用法?PHP api怎么用?PHP api使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了api类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: acumulus_inject_gateway
function acumulus_inject_gateway($vars)
{
$vars = array_merge($vars, getAddonVars());
if ($vars['filename'] != 'configgateways') {
return;
}
$api = new api($vars['code'], $vars['username'], $vars['password']);
$api->setCategory('picklists')->setAction('picklist_accounts');
$api->execute();
$response = $api->getResponse();
if ($api->hasErrors()) {
$response = array();
$response['accounts'] = array();
$response['accounts']['account'] = array();
$response['accounts']['account'][] = array('accountid' => '', 'accountnumber' => 'API errors', 'accountdescription' => null);
foreach ($api->getErrors() as $error) {
$response['accounts']['account'][] = array('accountid' => '', 'accountnumber' => $error['code'], 'accountdescription' => $error['message']);
}
}
$inject = '<script>';
$gatewayQuery = mysql_query('SELECT name.gateway, acumulus_account.value AS acumulus_account FROM tblpaymentgateways AS name LEFT JOIN tblpaymentgateways AS acumulus_account ON acumulus_account.setting = "acumulusAccount" AND acumulus_account.gateway = name.gateway WHERE name.setting = "name"');
while ($gatewayFetch = mysql_fetch_assoc($gatewayQuery)) {
$inject .= '$(\'#Payment-Gateway-Config-' . $gatewayFetch['gateway'] . '\').find(\'tr:last\').before(\'<tr><td class="fieldlabel">Acumulus rekening</td><td class="fieldarea"><select name="field[acumulusAccount]">';
foreach ($response['accounts']['account'] as $action) {
$inject .= '<option value="' . $action['accountid'] . '" ' . ($gatewayFetch['acumulus_account'] == $action['accountid'] ? 'selected="selected"' : '') . '>' . $action['accountnumber'] . '' . (is_string($action['accountdescription']) ? ' - ' . $action['accountdescription'] : '') . '</option>';
}
$inject .= '</select>Voeg alle facturen met deze betaalmethode toe aan een bepaalde rekening, <a href="https://wiki.acumulus.nl/index.php?page=payment-service-provider" target="_blank">zie hier waarom</a>.</td></tr>\');';
}
$inject .= '</script>';
return $inject;
}
示例2: getChampSquares
function getChampSquares()
{
$champSquares = scandir("../img/champs/squares");
?>
<ul class="champ-list mCustomScrollbar" data-mcs-theme="rounded-dots"> <?php
$api = new api();
$champions = json_decode($api->getChampionsList());
foreach ($champSquares as $key => $square) {
if ($key > 1) {
foreach ($champions->data as $champKey => $champion) {
if ($champion->name == str_replace('.png', '', $square)) {
?>
<li class="champ-list-element" data-champKey="<?php
print $champion->key;
?>
" onclick="selectChampion(this)" data-name="<?php
print str_replace('.png', '', $square);
?>
"><img src=" <?php
print "/img/champs/squares/" . $square;
?>
" class="champ-square darkened"></li>
<?php
}
}
}
}
}
示例3: setImageLinks
private function setImageLinks()
{
// Load the API for the user.
$api = new api($this->ID);
// Set/Get the image.
if ($api->valid()) {
$this->smallPicUrl = "<img src=\"https://image.eveonline.com/Character/" . $api->getCharacterID() . "_64.jpg\">";
$this->largePicUrl = "<img src=\"https://image.eveonline.com/Character/" . $api->getCharacterID() . "_256.jpg\">";
}
}
示例4: display_api_results
function display_api_results($test_code)
{
$api = new api();
$curl_result = $api->connect_api($test_code);
$i = 0;
echo "<pre>";
$size = sizeof($curl_result['report']['completed_test']);
for ($i; $i < $size; $i++) {
echo $i + 1 . ". " . $curl_result['report']['completed_test'][$i]['candidate_name'] . " & Score : " . $curl_result['report']['completed_test'][$i]['candidate_total_score'] . "<br>";
}
}
示例5: deleteAPIKey
function deleteAPIKey()
{
global $MySelf;
global $DB;
if ($MySelf->canManageUser()) {
numericCheck($_GET[id]);
$api = new api($_GET[id]);
$api->deleteApiKey();
makeNotice("Api key for user " . ucfirst(idToUsername($_GET[id])) . " has been deleted from the database", "notice", "API deleted.", "index.php?action=edituser&id=" . $_GET[id], "[OK]");
}
makeNotice("You do not have permission to modify users.", "warning", "Access denied.");
}
示例6: display
/**
* Methode zum anzeigen des Contents.
*
* @return String Content der Applikation.
*/
public function display()
{
$view = new View();
switch ($this->template) {
case 'createTables':
$view->setTemplate('createTables');
$oApi = new api();
$aResult = $oApi->createDatabase();
$view->assign('state', $aResult);
break;
case 'config':
$view->setTemplate('config');
if (!empty($this->sleep)) {
Model::setConfigSleepData($this->sleep);
}
$aConfigData = Model::getConfigSleepData();
$view->assign('config', $aConfigData);
break;
case 'report':
$view->setTemplate('report');
$view->assign('state', $this->state);
$aReportData = Model::getReportData();
$view->assign('data', $aReportData);
if (!empty($this->request['a'])) {
switch ($this->request['a']) {
case 1:
break;
case 2:
$view->assign('users', Model::getUser());
if ($this->user) {
$view->assign('reportDataByUser', Model::getReportDataByParams('reportUsers', $this->user));
} else {
$view->assign('reportDataByUser', Model::getReportDataByParams('reportUsers', '%%'));
}
break;
case 3:
$view->assign('reportDataApps', Model::getReportDataByApps());
break;
case 4:
$view->assign('reportDataMac', Model::getReportDataByParams('reportMac', '%%'));
break;
default:
}
}
break;
default:
$view->setTemplate('start');
}
return $view->loadTemplate();
}
示例7: sort
public function sort($id = '')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$uids = get('uids');
$flip = $blueprint->pages()->sort() == 'flip';
$children = $page->children();
if ($flip) {
$index = get('index', 1);
$uids = array_reverse($uids);
$n = $page->children()->visible()->count() - ($index * $blueprint->pages()->limit() - 1);
if ($n <= 0) {
$n = 1;
}
} else {
$index = get('index', 1) - 1;
$n = $blueprint->pages()->limit() * $index + 1;
}
foreach ($uids as $uid) {
try {
$child = $children->find($uid);
$x = api::createPageNum($child, $blueprint);
if ($x !== false and $x >= 0) {
$child->sort($x);
} else {
$child->sort($n);
}
$n++;
} catch (Exception $e) {
}
}
return response::success('success');
}
示例8: add
public function add($id = '/')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$templates = $blueprint->pages()->template();
$options = array();
$back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
$form = app::form('pages.add');
$form->save = l('add');
$form->back = a::get($back, get('to'));
foreach ($templates as $template) {
$options[$template->name()] = $template->title();
}
$select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
if ($templates->count() == 1) {
$select->readonly = true;
$select->value = $templates->first()->name();
}
$form->fields()->append('template', $select);
if (api::maxPages($page, $blueprint->pages()->max())) {
$form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
$form->save = false;
$form->centered = true;
}
return view('pages/add', array('page' => $page, 'form' => $form));
}
示例9: index
/**
* 获取群列表
*/
public function index()
{
if ($this->get_method() != 'GET') {
$this->send_response(405, NULL, '请求的方法不存在');
} else {
$data = $this->get_data();
$type = (int) $this->input->get('type', 0);
$result = $this->model->getUserAllGroup($this->user_id, $type);
$showTabList = Tab_Model::instance()->getList($this->user_id, 1);
$gidList = array();
foreach ($showTabList as $key => $value) {
if ($value['id'] != Kohana::config('uap.xiaomo_qun')) {
$gidList[$value['id']] = $key;
}
}
$groupList = array();
$privateType = Kohana::config('group.type.private');
foreach ($result as $value) {
$sort = (int) $gidList[$value['gid']];
$groupInfo = array();
$groupInfo['is_hide'] = 0;
if (array_key_exists($value['gid'], $gidList)) {
$groupInfo['is_hide'] = 0;
}
$groupInfo['id'] = floatval($value['gid']);
$groupInfo['name'] = $value['gname'];
$groupInfo['notice'] = $value['notice'];
$groupInfo['introduction'] = $value['introduction'];
$groupInfo['privacy'] = intval($value['privacy']);
$groupInfo['created_at'] = api::get_date($value['create_time']);
$groupInfo['modified_at'] = api::get_date($value['modify_time']);
$creator = array();
$creator['id'] = floatval($value['creator_id']);
$creator['name'] = sns::getrealname($value['creator_id']);
$creator['avatar'] = sns::getavatar($value['creator_id']);
$groupInfo['creator'] = $creator;
$groupInfo['master'] = $creator;
$managerIdList = $this->model->getManagerId($groupInfo['id']);
$managerList = array();
foreach ($managerIdList as $val) {
$manager = array();
$manager['id'] = floatval($val['uid']);
$manager['name'] = sns::getrealname($manager['id']);
$manager['avatar'] = sns::getavatar($manager['id']);
$managerList[] = $manager;
unset($manager);
}
$groupInfo['manager'] = $managerList;
$groupInfo['member_count'] = (int) $this->model->getGroupMemberNum($value['gid']);
$groupList[$sort] = $groupInfo;
unset($groupInfo);
unset($creator);
}
ksort($groupList);
foreach ($groupList as $group) {
$return_list[] = $group;
}
$this->send_response(200, $return_list);
}
}
示例10: index
public function index()
{
$users = $this->users()->map(function ($user) {
return api::user($user);
});
return response::json(array_values($users->toArray()));
}
示例11: show
public function show($id = null)
{
$filename = get('filename');
$page = $this->page($id);
$file = $this->file($page, $filename);
$blueprint = blueprint::find($page);
$fields = $blueprint->files()->fields($page);
$meta = $file->meta()->toArray();
$files = api::files($page, $blueprint);
$index = $files->indexOf($file);
$next = $files->nth($index + 1);
$prev = $files->nth($index - 1);
// breadcrumb items
if ($page->isSite()) {
$items = array(array('url' => purl('metatags'), 'title' => l('metatags')), array('url' => purl('files/index'), 'title' => l('metatags.files')), array('url' => purl($file, 'show'), 'title' => $file->filename()));
} else {
$items = array(array('url' => purl('files/index/' . $page->id()), 'title' => l('files')), array('url' => purl($file, 'show'), 'title' => $file->filename()));
}
// file info display
$info = array();
$info[] = $file->type();
$info[] = $file->niceSize();
if ((string) $file->dimensions() != '0 x 0') {
$info[] = $file->dimensions();
}
return view('files/show', array('topbar' => new Snippet('pages/topbar', array('menu' => new Snippet('menu'), 'breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page, 'items' => $items)), 'search' => purl($page, 'search'))), 'form' => new Form($fields->toArray(), $meta), 'p' => $page, 'f' => $file, 'next' => $next, 'prev' => $prev, 'info' => implode(' / ', $info)));
}
示例12: getAllBranch
public static function getAllBranch()
{
$api = new api();
$ss = $api->getSsName();
$all_branch = [];
$all_ss = [];
$ss_address = [];
$ss_tel = [];
foreach ($ss as $k => $v) {
$all_branch[$v['branch_code']] = $v['branch_name'];
$all_ss[$v['sscode']] = $v['ss_name'];
$all_ss_branch[$v['sscode']] = $v['branch_code'];
$all_branch_ss[$v['branch_code']][] = $v['sscode'];
$ss_address[$v['sscode']] = $v['address'];
$ss_tel[$v['sscode']] = $v['tel'];
}
return ['all_ss' => $all_ss, 'all_branch' => \Yii::$app->params['branch'], 'all_branch_ss' => $all_branch_ss, 'all_ss_branch' => $all_ss_branch, 'ss_address' => $ss_address, 'ss_tel' => $ss_tel];
}
示例13: login_action
public function login_action()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($_POST['email']) || empty($_POST['password']) || !account::log_in($_POST['email'], $_POST['password'])) {
return api::result(false);
}
return api::result(true);
}
return api::result(false);
}
示例14: load_for_cache
/**
* Loads the data for the key provided ready formatted for caching.
*
* @param string|int $key The key to load.
* @return mixed What ever data should be returned, or false if it can't be loaded.
*/
public function load_for_cache($key)
{
list($userid1, $userid2) = explode('_', $key);
$message = api::get_most_recent_message($userid1, $userid2);
if ($message) {
return $message->timecreated;
} else {
return null;
}
}
示例15: formatted_action
public function formatted_action($key)
{
if (empty($key)) {
return api::result(false, array('message' => 'No_key_provided'));
}
$kb = knowledge_base_article::load_one($key, 'key');
if (!$kb) {
return api::result(false, array('message' => 'Article_not_found'));
}
return api::result(true, array('formatted' => addslashes($kb->formatted())));
}