本文整理汇总了PHP中api类的典型用法代码示例。如果您正苦于以下问题:PHP api类的具体用法?PHP api怎么用?PHP api使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了api类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:0100Dev,项目名称:WHMCS-Acumulus,代码行数:31,代码来源:hooks.php
示例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
}
}
}
}
}
开发者ID:angrytoad,项目名称:ItemFeed,代码行数:28,代码来源:champion-select-list.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\">";
}
}
开发者ID:nuxi,项目名称:MiningBuddy,代码行数:10,代码来源:profile_class.php
示例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>";
}
}
开发者ID:CCNITSilchar,项目名称:hof.ccnits.com,代码行数:11,代码来源:display_api_results.php
示例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.");
}
开发者ID:nuxi,项目名称:MiningBuddy,代码行数:12,代码来源:deleteAPIKey.php
示例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();
}
开发者ID:Dennis-Bezold,项目名称:WER_Reports,代码行数:55,代码来源:controller.php
示例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');
}
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:33,代码来源:pages.php
示例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));
}
开发者ID:kompuser,项目名称:panel,代码行数:26,代码来源:pages.php
示例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);
}
}
开发者ID:momoim,项目名称:momo-api,代码行数:63,代码来源:group.php
示例10: index
public function index()
{
$users = $this->users()->map(function ($user) {
return api::user($user);
});
return response::json(array_values($users->toArray()));
}
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:7,代码来源:users.php
示例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)));
}
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:27,代码来源:files.php
示例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];
}
开发者ID:huylv-hust,项目名称:ws,代码行数:18,代码来源:utilities.php
示例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);
}
开发者ID:TorbenKoehn,项目名称:lok,代码行数:10,代码来源:account.php
示例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;
}
}
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:16,代码来源:time_last_message_between_users.php
示例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())));
}
开发者ID:TorbenKoehn,项目名称:lok,代码行数:11,代码来源:kb.php
示例16: rest
public function rest()
{
$api = api::get();
$args = func_get_args();
// Normal request
if (!$api) {
print_r($args);
} else {
echo json_encode($args, TRUE);
}
}
开发者ID:reang,项目名称:Dingo-Framework,代码行数:11,代码来源:main.php
示例17: create
/**
*
* @param $title
* @param $description
* @param $price
* @param $sync
* @param $private
* @param $image
* @param $location
* @return unknown_type
*/
public function create($title, $description, $price, $private, $image, $location, $user_id, $sync)
{
$deal_id = api::uuid();
$setters = array('deal_id' => $deal_id, 'uid' => $user_id, 'longitude' => $location['longitude'] ? $location['longitude'] : 0, 'latitude' => $location['latitude'] ? $location['latitude'] : 0, 'price' => $price, 'private' => $private, 'created_at' => time(), 'modified_at' => time());
if ($this->db->insertData('deals', $setters)) {
$image = $this->_warp_image($image);
if ($this->_insert_mongo(array('deal_id' => $deal_id, 'uid' => $user_id, 'title' => $title, 'description' => $description, 'image' => $image, 'sync' => $sync))) {
return true;
}
}
return false;
}
开发者ID:momoim,项目名称:momo-api,代码行数:23,代码来源:deal.php
示例18: index
public function index()
{
$site = site();
$blueprint = blueprint::find($site);
$fields = $blueprint->fields($site)->toArray();
$content = $site->content()->toArray();
$files = null;
// create the files
if ($blueprint->files()->max() !== 0 and $blueprint->files()->hide() == false) {
$files = new Snippet('pages/sidebar/files', array('page' => $site, 'files' => api::files($site, $blueprint)));
}
return view('metatags/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb', array('items' => array(array('title' => l('metatags'), 'url' => purl('metatags/'))))), 'search' => purl('pages/search/'))), 'form' => new Form($fields, $content), 's' => $site, 'files' => $files, 'license' => panel()->license()));
}
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:13,代码来源:metatags.php
示例19: getFunction
/**
* Funcion: getFunction
* Descripcion: Dirige la peticion a la funcion correspondiente
* @param api $api
* @return $salida
* @throws Exception
* @author Rodrigo Contreras B. <[email protected]>
* @version 2015-12-07 - Version Inicial
* @version 2015-12-29 - Simplificacion metodo de llamados
* @since 2015-12-07
*/
function getFunction(api $api)
{
// Variables Generales
$request = $this->setRequest();
$withRequest = 0;
// Librerias
$controller = $api->getController();
$controllerBusiness = $api->getController() . 'Business';
// Crea objeto si existe la clase
if (!class_exists($controllerBusiness)) {
$api->setTipo("Error");
$api->setMensaje("No existe el Controlador Asociado");
$salida = $api;
} else {
// Creacion del Objeto Business correspondiente
$objBusiness = new $controllerBusiness();
// Creacion del objeto controlador
if (file_exists('../model/' . $controller . '.php')) {
$obj = new $controller();
}
// Verificacion de existencia business
if (file_exists('../business/' . $controller . 'Business.php')) {
// Identificacion de funcion requestToObjeto
$req = 'requestTo' . $controller;
// Verificacion de existencia de metodo dentro de clase
if (method_exists($objBusiness, $req)) {
$obj = $objBusiness->{$req}($request);
$withRequest = 1;
}
}
// Identificacion Metodo
$metodo = $api->getAccion();
if (!method_exists($objBusiness, $metodo)) {
$api->setTipo("Error");
$api->setMensaje("No existe el Metodo Asociado");
$salida = $api;
} else {
// Llamado a metodo para salida de datos
if ($withRequest == 1) {
$salida = $objBusiness->{$metodo}($obj);
} else {
$salida = $objBusiness->{$metodo}();
}
}
}
// Retorno
return $salida;
}
开发者ID:rodrigocontrerasb,项目名称:SalchiMVC,代码行数:59,代码来源:ApiBusiness.php
示例20: initAPI
function initAPI()
{
global $mods;
global $core;
/** Variables */
$started = session_start();
$uid = session_id();
$received = $_REQUEST;
$expecting = ['class', 'method', 'type', 'data'];
/** Include API Class and Change to System */
include 'api.php';
chdir("../../system");
/** Loop through the expected input, ignoring others to set varNames*/
foreach ($expecting as $varName) {
${$varName} = isset($received[$varName]) ? $received[$varName] : ($varName == 'data' ? [] : null);
}
/** Create an API Request Object for Input */
$request = new apiRequest($class, $method, $type, $data);
$api = new api();
/** Boot Framework */
$booted = (include 'bootstrap/bootstrap.php');
if (!$booted) {
throw new exception("Boot Manager Missing!");
exit;
}
$plugableLibraries = [];
boot(new bootMode('api'), $plugableLibraries);
/** Create New API Core */
$core = new core($api, $plugableLibraries, $mods);
/** Add Request to Queue */
$requestId = $api->addRequest($request);
/** Process API Request */
$results = $core->processRequests();
$apiResult = $results[$requestId];
/** Encode Result */
$jsonResult = json_encode($apiResult);
return $jsonResult;
}
开发者ID:php-plat,项目名称:plat,代码行数:38,代码来源:index.php
注:本文中的api类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论