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


PHP API::init方法代码示例

本文整理汇总了PHP中API::init方法的典型用法代码示例。如果您正苦于以下问题:PHP API::init方法的具体用法?PHP API::init怎么用?PHP API::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


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

示例1: doInit

function doInit()
{
    if (Config::$pass == null) {
        Config::$pass = trim(file_get_contents(getenv("HOME") . '/.cluebotng.password.only'));
    }
    API::init();
    API::$a->login(Config::$user, Config::$pass);
    Globals::$mysql = false;
    checkMySQL();
    Globals::$tfas = 0;
    Globals::$stdin = fopen('php://stdin', 'r');
    Globals::$run = API::$q->getpage('User:' . Config::$user . '/Run');
    Globals::$wl = API::$q->getpage('Wikipedia:Huggle/Whitelist');
    Globals::$optin = API::$q->getpage('User:' . Config::$user . '/Optin');
    Globals::$aoptin = API::$q->getpage('User:' . Config::$user . '/AngryOptin');
    Globals::$stalk = array();
    Globals::$edit = array();
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutostalk.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$stalk[$tmp3[0]] = trim($tmp3[1]);
        }
    }
    $tmp = explode("\n", API::$q->getpage('User:' . Config::$owner . '/CBAutoedit.js'));
    foreach ($tmp as $tmp2) {
        if (substr($tmp2, 0, 1) != '#') {
            $tmp3 = explode('|', $tmp2, 2);
            Globals::$edit[$tmp3[0]] = trim($tmp3[1]);
        }
    }
}
开发者ID:Riamse,项目名称:cluebotng,代码行数:32,代码来源:misc_functions.php

示例2: api_zbp_load_pre

function api_zbp_load_pre()
{
    // Check URL first
    global $bloghost;
    global $apiRealRouteUrl;
    global $zbp;
    $requestUri = str_replace('index.php?', '', GetVars('HTTP_HOST', 'SERVER') . GetVars('REQUEST_URI', 'SERVER'));
    $removedHttpHost = preg_replace('/^http.+\\/\\//', '', $bloghost) . 'zb_system/api/';
    $apiRealRouteUrl = str_replace($removedHttpHost, '', $requestUri);
    // Now we know that this is API Request, so remove Cookie.
    // The verification shoule be in API Route.
    //$_COOKIE['username'] = "";
    //$_COOKIE['password'] = "";
    API::init();
}
开发者ID:zblogcn,项目名称:zblogphp,代码行数:15,代码来源:index.php

示例3: parseQuery

        $this->mysqli = new mysqli(self::DB_SERVER, self::DB_USER, self::DB_PASSWORD, self::DB);
    }
    private function parseQuery($query)
    {
        $r = $this->mysqli->query($query) or die($this->mysqli->error . __LINE__);
        if ($r->num_rows > 0) {
            $result = array();
            while ($row = $r->fetch_assoc()) {
                $result[] = $row;
            }
            $this->response($this->jsonify($result), 200);
        }
        $this->response("", 204);
    }
    // API Functions
    private function login()
    {
        $this->check_request_method();
        $query = "SELECT u.* FROM users u";
        $this->parseQuery($query);
    }
    private function getClients()
    {
        $this->check_request_method();
        $query = "SELECT c.*, e.employeeNumber, e.lastName AS 'em_lastName', e.firstName AS 'em_firstName', e.email AS 'em_email',\r\n\t\t\t\t\to.city AS 'o_city',\r\n\t\t\t\t\tps.*,\r\n\t\t\t\t\tos.*\r\n\t\t\t\tFROM customers c\r\n\t\t\t\tLEFT JOIN employees e ON e.employeeNumber = c.salesRepEmployeeNumber\r\n\t\t\t\tLEFT JOIN offices o ON o.officeCode = e.officeCode\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t(SELECT p.customerNumber AS p_customerNumber,\r\n\t\t\t\t\t\tGROUP_CONCAT(p.checkNumber) AS p_checks,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(p.paymentDate, CHAR(16))) AS p_dates,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(p.amount, CHAR(16))) AS p_amounts\r\n\t\t\t\t\t\tFROM payments p GROUP BY p.customerNumber) ps\r\n\t\t\t\t\tON ps.p_customerNumber = c.customerNumber\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t(SELECT o.customerNumber AS o_customerNumber,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(o.orderNumber, CHAR(16))) AS o_orders,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(o.orderDate, CHAR(16))) AS o_orderDates,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(o.requiredDate, CHAR(16))) AS o_requiredDates,\r\n\t\t\t\t\t\tGROUP_CONCAT(CONVERT(o.shippedDate, CHAR(16))) AS o_shippedDates,\r\n\t\t\t\t\t\tGROUP_CONCAT(o.status) AS o_statuses,\r\n\t\t\t\t\t\tGROUP_CONCAT(o.comments) AS o_comments\r\n\t\t\t\t\t\tFROM orders o GROUP BY o.customerNumber) os\r\n\t\t\t\t\tON os.o_customerNumber = c.customerNumber";
        $this->parseQuery($query);
    }
}
$api = new API();
$api->init();
开发者ID:parxomchik,项目名称:angular-mysql-php,代码行数:30,代码来源:api.php

示例4: catch

<?php

require_once __DIR__ . '/../API.php';
API::init();
if (!Config::get("realtime.enabled")) {
    http_response_code(403);
    API::printJSON(array('error' => 'Realtime disabled'));
}
try {
    $ts3 = new Ts3ServerQuery(Config::get("realtime.host"), Config::get("realtime.port", 10011), Config::get("realtime.username", "serveradmin"), Config::get("realtime.password"));
    $users = RealtimeUsers::getOnlineUsers($ts3);
    $channels = RealtimeChannels::getChannels($ts3);
} catch (Exception $e) {
    http_response_code(500);
    API::printJSON(array('error' => 'Boh...'));
}
API::printJSON(RealtimeFormatter::getRealtime($users, $channels));
开发者ID:TheEntropics,项目名称:TeamSpeak3-stats,代码行数:17,代码来源:realtime.php

示例5: API

<?php

/**
* This is the main initiation file for the API.
*
* LICENSE: MIT (http://opensource.org/licenses/mit-license.html)
*
* @category XboxLeaders
* @package XboxLiveAPI
* @copyright Copyright (c) 2012 - 2014 XboxLeaders
* @license http://xboxleaders.github.io/license/ MIT License
* @version 2.0
* @link http://github.com/XboxLeaders/XboxLiveAPI
* @since File available since Release 1.0
*/
include 'classes/api.class.php';
$api = new API($cache);
if (isset($_GET['callback']) && !empty($_GET['callback'])) {
    $api->format = 'jsonp';
    $api->callback = preg_replace('/(<.*>)|(.*;)/g', '', $_GET['callback']);
} else {
    $api->format = isset($_GET['format']) && in_array($_GET['format'], array('xml', 'json', 'php')) ? strtolower(trim($_GET['format'])) : 'json';
}
$api->version = '2.0';
$api->debug = isset($_GET['debug']);
$api->cookie_file = COOKIE_FILE;
$api->debug_file = DEBUG_FILE;
$api->stack_trace_file = STACK_TRACE_FILE;
$api->init(XBOX_EMAIL, XBOX_PASSWORD);
开发者ID:gokuale,项目名称:XboxLiveAPI,代码行数:29,代码来源:kernel.php

示例6: error_reporting

<?php

/*
 * 功       能: API启动文件,将调用所需API
 * 作       者: 刘海艇
 * 修改日期: 2013-06-22
 */
error_reporting(E_ERROR);
include_once "api.config.php";
include_once "api.class.php";
include_once "api.functions.php";
include_once 'api.returnCode.php';
$api = API::init();
//token验证
if (!empty($_GET["echostr"])) {
    $api->check();
}
//消息回复
$api->responseMsg();
开发者ID:Nightchen0521,项目名称:cmf,代码行数:19,代码来源:boot.php


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