当前位置: 首页>>代码示例>>PHP>>正文


PHP getClient函数代码示例

本文整理汇总了PHP中getClient函数的典型用法代码示例。如果您正苦于以下问题:PHP getClient函数的具体用法?PHP getClient怎么用?PHP getClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getClient函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAnalytics

function getAnalytics()
{
    $client = getClient();
    $token = Authenticate($client);
    $analytics = new Google_Service_Analytics($client);
    return $analytics;
}
开发者ID:Steadroy,项目名称:Dashboard,代码行数:7,代码来源:ganalytics.php

示例2: setUp

 /**
  * @throws ClientException
  */
 public function setUp()
 {
     $connector = new Connector($this->client);
     $this->client = getClient($connector);
     $collectionName = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection';
     $collectionOptions = ['waitForSync' => true];
     $collectionParameters = [];
     $options = $collectionOptions;
     $this->client->bind('Request', function () {
         $request = $this->client->getRequest();
         return $request;
     });
     $request = $this->client->make('Request');
     $request->options = $options;
     $request->body = ['name' => $collectionName];
     $request->body = self::array_merge_recursive_distinct($request->body, $collectionParameters);
     $request->body = json_encode($request->body);
     $request->path = $this->client->fullDatabasePath . self::API_COLLECTION;
     $request->method = self::METHOD_POST;
     $responseObject = $request->send();
     $body = $responseObject->body;
     $this->assertArrayHasKey('code', json_decode($body, true));
     $decodedJsonBody = json_decode($body, true);
     $this->assertEquals(200, $decodedJsonBody['code']);
     $this->assertEquals($collectionName, $decodedJsonBody['name']);
 }
开发者ID:frankmayer,项目名称:arangodb-php-core,代码行数:29,代码来源:DocumentTest.php

示例3: getAccessToken

function getAccessToken(&$fb, $bucket, $tokenFile)
{
    // Read file from Google Storage
    $client = getClient();
    $storage = getStorageService($client);
    $tokensStr = getTokens($client, $storage, $bucket, $tokenFile);
    if (empty($tokensStr)) {
        quit("No more FB access tokens in storage -- login to app ASAP to generate a token");
    } else {
        $tokens = json_decode($tokensStr, true);
        // 'true' will turn this into associative array instead of object
        // Validate the token before use. User may have logged off facebook, or deauthorized this app.
        // shuffle the array to get random order of iteration
        shuffle($tokens);
        //var_dump($tokens);
        foreach ($tokens as $token) {
            $response = $fb->get('/me', $token);
            if (!$response->isError()) {
                // access_token is valid token
                return $token;
            }
        }
        quit("None of the tokens are valid");
    }
}
开发者ID:girishji,项目名称:zouk-event-calendar,代码行数:25,代码来源:cronjob.php

示例4: setUp

 /**
  *
  */
 public function setUp()
 {
     $connector = new Connector();
     $this->client = $this->client = getClient($connector);
     $this->collectionNames[0] = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection-01';
     $this->collectionNames[1] = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection-02';
     $this->collectionNames[2] = 'ArangoDB-PHP-Core-CollectionTestSuite-Collection-03';
 }
开发者ID:frankmayer,项目名称:arangodb-php-core,代码行数:11,代码来源:BatchTest.php

示例5: setUp

 /**
  *
  */
 public function setUp()
 {
     $connector = new Connector();
     $this->connector = $connector;
     $this->client = $this->client = getClient($connector);
     $this->client->bind('Request', function () {
         $request = $this->client->getRequest();
         return $request;
     });
 }
开发者ID:frankmayer,项目名称:arangodb-php-core,代码行数:13,代码来源:IocTest.php

示例6: IsSubscribed

 public static function IsSubscribed($clientId = NULL)
 {
     if (is_null($clientId)) {
         if (!isset($_GET["clientid"])) {
             return NULL;
         } else {
             $CurrentClientId = $_GET["clientid"];
             return self::IsSubscribed($CurrentClientId);
         }
     }
     return getClient($clientId)->IsSubscribed;
 }
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:12,代码来源:DataServiceClientRegistry.php

示例7: __construct

 function __construct($appid, $appsecret, $mime_type, $folder_id)
 {
     $curl_options = array(CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_SSL_VERIFYHOST => FALSE, CURLOPT_FORBID_REUSE => TRUE, CURLOPT_SSLVERSION => 1, CURLOPT_FORBID_REUSE => TRUE, CURLOPT_RETURNTRANSFER => TRUE);
     $this->parallel_curl = new ParallelCurl(100, $curl_options);
     $this->appid = $appid;
     $this->appsecret = $appsecret;
     $this->mime_type = $mime_type;
     $this->folder_id = $folder_id;
     $this->cache = new Cache();
     $this->cache->setCache('cache');
     $this->get_token_from_wechat();
     if (file_exists(__DIR__ . "/csv/") == false) {
         mkdir(__DIR__ . "/csv/");
     }
     $this->client = getClient();
     $this->service = new Google_Service_Drive($this->client);
 }
开发者ID:patrick-ckf,项目名称:wechat_api,代码行数:17,代码来源:wechat_api.php

示例8: fetchPages

/**
 * Fetch and process a paged response from JoindIn.
 *
 * @param $initial
 *   The initial URL to fetch. That URL may result in others getting
 *   fetched as well.
 * @param callable $processor
 *   A callable that will be used to process each page of results. Its signature
 *   must be: (\SplQueue $pages, ResponseInterface $response, $index)
 * @param int $concurrency
 *   The number of concurrent requests to send. In practice this kinda has to
 *   be 1, or else Guzzle will conclude itself before getting to later-added
 *   entries.
 */
function fetchPages($initial, callable $processor, $concurrency = 1)
{
    $client = getClient();
    $pages = new \SplQueue();
    $pages->enqueue($initial);
    $pageProcessor = partial($processor, $pages);
    $pageRequestGenerator = function (\SplQueue $pages) {
        foreach ($pages as $page) {
            (yield new Request('GET', $page));
        }
    };
    $pool = new Pool($client, $pageRequestGenerator($pages), ['concurrency' => $concurrency, 'fulfilled' => $pageProcessor]);
    // Initiate the transfers and create a promise
    $promise = $pool->promise();
    // Force the pool of requests to complete.
    $promise->wait();
}
开发者ID:heiglandreas,项目名称:joindinaudit,代码行数:31,代码来源:download.php

示例9: getClientForToken

function getClientForToken ($access_token, $fake_it = false) {
    $client = getClient();
    $accessToken = false;

    // Since w're passed the access_token part only,
    // we will fake the token.
    // We don't know when it was created or when it expires,
    // so we fake it.
    $tmpl = '{
    "access_token":"%s",
        "token_type":"Bearer",
        "expires_in":"3600",
        "id_token":"",
        "created":%s}'; 

    $token_file = PATH.'/tokens/'.$access_token;
    if (!file_exists($token_file)) {
        if ($fake_it) {
            $accessToken = sprintf($tmpl, $access_token, time());
        }
    } else {
        $accessToken = file_get_contents(PATH.'/tokens/'.$access_token);
    }

    if (empty($accessToken)) {
        $client = null;
    } else {
        $client->setAccessToken($accessToken);

        // Refresh the token if it's expired.
        if ($client->isAccessTokenExpired()) {
            $refreshToken = $client->getRefreshToken();
            if (!empty($refreshToken)) {
                $client->refreshToken($refreshToken);
                //We'd want to return this.
                $accessToken = $client->getAccessToken();
                file_put_contents(PATH.'/tokens/'.$access_token);
            }
        }
    }

    return $client;
}
开发者ID:roundbrackets,项目名称:zugata,代码行数:43,代码来源:inc.php

示例10: setUp

 /**
  *
  */
 public function setUp()
 {
     $connector = new Connector();
     $this->client = getClient($connector);
 }
开发者ID:frankmayer,项目名称:arangodb-php-core,代码行数:8,代码来源:PluginTest.php

示例11: print_usage

}
if (!isset($arguments['partner_id']) || !$arguments['partner_id'] || is_null($arguments['partner_id'])) {
    print_usage('missing argument --partner_id');
}
if (!isset($arguments['admin_secret']) || !$arguments['admin_secret'] || is_null($arguments['admin_secret'])) {
    print_usage('missing argument --admin_secret');
}
if (!isset($arguments['host']) || !$arguments['host'] || is_null($arguments['host'])) {
    print_usage('missing argument --host');
}
if (!file_exists($arguments['ini'])) {
    print_usage('config file not found ' . $arguments['ini']);
}
error_reporting(0);
$confObj = init($arguments['ini'], $arguments['infra']);
$kclient = getClient($arguments['partner_id'], $arguments['admin_secret'], $arguments['host']);
$baseTag = $confObj->general->component->name;
$defaultTags = "autodeploy, {$baseTag}_{$confObj->general->component->version}";
$sections = explode(',', $confObj->general->component->required_widgets);
if ($includeCode) {
    $code[] = '$c = new Criteria();';
    $code[] = '$c->addAnd(UiConfPeer::PARTNER_ID, ' . $confObj->statics->partner_id . ');';
    $code[] = '$c->addAnd(UiConfPeer::TAGS, "%' . $baseTag . '_".$this->kmc_' . $baseTag . '_version."%", Criteria::LIKE);';
    $code[] = '$c->addAnd(UiConfPeer::TAGS, "%autodeploy%", Criteria::LIKE);';
    $code[] = '$this->confs = UiConfPeer::doSelect($c);';
}
$tags_search = array();
foreach ($sections as $section) {
    $sectionName = trim($section);
    $sectionBase = $sectionName . 's';
    $baseSwfUrl = $confObj->{$sectionName}->{$sectionBase}->swfpath;
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:deploy_client.php

示例12: testPre

/**
 * When a test case contains adds/modifies/deletes being sent to the server,
 * these changes must be extracted from the test data and manually performed
 * using the api to achieve the desired behaviour by the server
 *
 * @throws Horde_Exception
 */
function testPre($name, $number)
{
    global $debuglevel;
    $ref0 = getClient($name, $number);
    // Extract database (in horde: service).
    if (preg_match('|<Alert>.*?<Target>\\s*<LocURI>([^>]*)</LocURI>.*?</Alert>|si', $ref0, $m)) {
        $GLOBALS['service'] = $m[1];
    }
    if (!preg_match('|<SyncHdr>.*?<Source>\\s*<LocURI>(.*?)</LocURI>.*?</SyncHdr>|si', $ref0, $m)) {
        echo $ref0;
        throw new Horde_Exception('Unable to find device id');
    }
    $device_id = $m[1];
    // Start backend session if not already done.
    if ($GLOBALS['testbackend']->getSyncDeviceID() != $device_id) {
        $GLOBALS['testbackend']->sessionStart($device_id, null, Horde_SyncMl_Backend::MODE_TEST);
    }
    // This makes a login even when a logout has occured when the session got
    // deleted.
    $GLOBALS['testbackend']->setUser(SYNCMLTEST_USERNAME);
    $ref1 = getServer($name, $number + 1);
    if (!$ref1) {
        return;
    }
    $ref1 = str_replace(array('<![CDATA[', ']]>', '<?xml version="1.0"?><!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.1//EN" "http://www.syncml.org/docs/syncml_represent_v11_20020213.dtd">'), '', $ref1);
    // Check for Adds.
    if (preg_match_all('|<Add>.*?<type[^>]*>(.*?)</type>.*?<LocURI[^>]*>(.*?)</LocURI>.*?<data[^>]*>(.*?)</data>.*?</Add|si', $ref1, $m, PREG_SET_ORDER)) {
        foreach ($m as $c) {
            list(, $contentType, $locuri, $data) = $c;
            // Some Sync4j tweaking.
            switch (Horde_String::lower($contentType)) {
                case 'text/x-s4j-sifn':
                    $data = Horde_SyncMl_Device_sync4j::sif2vnote(base64_decode($data));
                    $contentType = 'text/x-vnote';
                    $service = 'notes';
                    break;
                case 'text/x-s4j-sifc':
                    $data = Horde_SyncMl_Device_sync4j::sif2vcard(base64_decode($data));
                    $contentType = 'text/x-vcard';
                    $service = 'contacts';
                    break;
                case 'text/x-s4j-sife':
                    $data = Horde_SyncMl_Device_sync4j::sif2vevent(base64_decode($data));
                    $contentType = 'text/calendar';
                    $service = 'calendar';
                    break;
                case 'text/x-s4j-sift':
                    $data = Horde_SyncMl_Device_sync4j::sif2vtodo(base64_decode($data));
                    $contentType = 'text/calendar';
                    $service = 'tasks';
                    break;
                case 'text/x-vcalendar':
                case 'text/calendar':
                    if (preg_match('/(\\r\\n|\\r|\\n)BEGIN:\\s*VTODO/', $data)) {
                        $service = 'tasks';
                    } else {
                        $service = 'calendar';
                    }
                    break;
                default:
                    throw new Horde_Exception("Unable to find service for contentType={$contentType}");
            }
            $result = $GLOBALS['testbackend']->addEntry($service, $data, $contentType);
            if (is_a($result, 'PEAR_Error')) {
                echo "error importing data into {$service}:\n{$data}\n";
                throw new Horde_Exception_Wrapped($result);
            }
            if ($debuglevel >= 2) {
                echo "simulated {$service} add of {$result} as {$locuri}!\n";
                echo '   at ' . date('Y-m-d H:i:s') . "\n";
                if ($debuglevel >= 10) {
                    echo "data: {$data}\nsuid={$result}\n";
                }
            }
            // Store UID used by server.
            $GLOBALS['mapping_locuri2uid'][$locuri] = $result;
        }
    }
    // Check for Replaces.
    if (preg_match_all('|<Replace>.*?<type[^>]*>(.*?)</type>.*?<LocURI[^>]*>(.*?)</LocURI>.*?<data[^>]*>(.*?)</data>.*?</Replace|si', $ref1, $m, PREG_SET_ORDER)) {
        foreach ($m as $c) {
            list(, $contentType, $locuri, $data) = $c;
            // Some Sync4j tweaking.
            switch (Horde_String::lower($contentType)) {
                case 'sif/note':
                case 'text/x-s4j-sifn':
                    $data = Horde_SyncMl_Device_sync4j::sif2vnote(base64_decode($data));
                    $contentType = 'text/x-vnote';
                    $service = 'notes';
                    break;
                case 'sif/contact':
                case 'text/x-s4j-sifc':
                    $data = Horde_SyncMl_Device_sync4j::sif2vcard(base64_decode($data));
//.........这里部分代码省略.........
开发者ID:horde,项目名称:horde,代码行数:101,代码来源:testsync.php

示例13: setUp

 /**
  *
  */
 public function setUp()
 {
     $this->connector = $this->getMockBuilder('TestConnector')->getMock();
     $this->client = getClient($this->connector);
 }
开发者ID:frankmayer,项目名称:arangodb-php-core,代码行数:8,代码来源:TracerPluginUnitTest.php

示例14: checkSession

include_once "mod.order.php";
include_once "mod.optional.php";
include_once "ctrl.order.php";
include_once "ctrl.client.php";
include_once "ctrl.login.php";
// check user  authentication
checkSession($_SESSION['sess_user_id']);
if (isset($_GET['ordid'])) {
    $oid = $_GET['ordid'];
    $orddetail = getOrderById($oid, $db);
    $rf = getRf($db);
    $odrf = getRfById($oid, $db);
    $os = getOS($db);
    $app = getApp($db);
    $odapp = getAppById($oid, $db);
    $cli = getClient($db);
    $sta = getStatus($db);
} else {
    header("location: " . ROOT . "order_list.php");
    exit;
}
?>
<html lang="en-US">
<head>
    <meta charset="utf-8">
    <link href="<?php 
echo CSS;
?>
import.css" type="text/css" rel="stylesheet"/>
    <script src="<?php 
echo JS;
开发者ID:htareilwin91,项目名称:git_review,代码行数:31,代码来源:order_detail.php

示例15: getClient

<?php

include_once "session.php";
$search = $_POST['searchFor'];
$where = $_POST['where'];
if ($where == "Clients") {
    if (strlen($search) == 0) {
        getClient(0, "all");
    } else {
        searchClient($search);
    }
} elseif ($where == "Drivers") {
    if (strlen($search) == 0) {
        getDrivers(0, "all");
    } else {
        searchDriver($search);
    }
} elseif ($where == "Deliveries") {
    if (strlen($search) == 0) {
        //Get all data here
    } else {
        //Get specific data here.
    }
} elseif ($where == "Reports") {
    if (strlen($search) == 0) {
        getEmergencyTable(0, "all");
    } else {
        searchEmergencies($search);
    }
} elseif ($where == "Accounts") {
    if (strlen($search) == 0) {
开发者ID:Xaranta,项目名称:MOW-Delivery,代码行数:31,代码来源:search.php


注:本文中的getClient函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。