本文整理汇总了PHP中API::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP API::__construct方法的具体用法?PHP API::__construct怎么用?PHP API::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct()
{
/* Since parent constructors are not called implicitly if */
/* the child class defines a constructor we simpley call it */
/* here to inherit the parent's methods and bad habits. */
parent::__construct();
}
示例2: __construct
public function __construct($request, $origin)
{
$this->config = (include 'config.php');
$this->initDB();
$this->sanitizeHTTPParameters();
parent::__construct($request);
}
示例3: __construct
public function __construct($request)
{
parent::__construct($request);
// Grab the uid from Webauth, API Key lookup, etc
if (array_key_exists("WEBAUTH_USER", $_SERVER)) {
$this->uid = htmlentities($_SERVER["WEBAUTH_USER"]);
$this->webauth = true;
} else {
if ($this->api_key) {
$this->uid = $this->_lookupUser($this->api_key);
$this->webauth = false;
} else {
if (DEBUG) {
$this->uid = DEBUG_USER_UID;
$this->webauth = true;
} else {
$this->uid = false;
$this->webauth = false;
}
}
}
// Check if the user is a drink admin
if ($this->uid != false) {
$this->admin = $this->_isAdmin($this->uid);
}
}
示例4: __construct
public function __construct()
{
parent::__construct(get_class(), 'robotpony-4.1');
$this->root = realpath(dirname(__FILE__) . '/db/');
$this->newest = $this->root . '/newest.json';
$this->listing = $this->root . '/comics.json';
// other startup here
}
示例5: __construct
public function __construct()
{
parent::__construct(get_class(), 'robotpony-4.1');
$this->root = realpath(dirname(__FILE__) . '/pages/') . '/';
$this->inc = realpath(dirname(__FILE__) . '/lib/') . '/';
Response::add_type_handler('text/plain', function ($dom) {
print json_encode($dom);
});
}
示例6:
function __construct()
{
parent::__construct();
$this->ca = CAHandler::getCA($this->person);
$perm = $this->person->mayRequestCertificate();
if (!$perm->isPermissionGranted()) {
$this->errorNotAuthorized($perm);
}
}
示例7: __construct
public function __construct($request)
{
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
$this->loadConfig();
$this->initDB();
$this->sanitizeHTTPParameters();
parent::__construct($request);
}
示例8: __construct
public function __construct($action, $params)
{
parent::__construct($action, $params);
//check if the action is available for the resource
if (!method_exists($this, $action)) {
HTTP::response('404');
}
//call the action on the resource
$this->{$action}($params);
}
示例9: __construct
public function __construct($request, $origin)
{
parent::__construct($request);
// Abstracted out for example
//@todo: should create apiKey class to provide functionality to create apiKey
/* if (!array_key_exists('apiKey', $this->request)) {
throw new Exception('No API Key provided');
} else if (!$APIKey->verifyKey($this->request['apiKey'], $origin)) {
throw new Exception('Invalid API Key');
}*/
}
示例10: __construct
public function __construct($request, $origin)
{
parent::__construct($request);
//Check if token present in the header
if (!array_key_exists('Token', $this->headers) && $request != 'get_token') {
throw new Exception('No API Token provided');
}
//Authenticate Token
if (!in_array($this->headers['Token'], $_SESSION) && $request != 'get_token') {
throw new Exception('Expired or Invalid API Token');
}
}
示例11: __construct
public function __construct($request)
{
$this->loadConfig();
$this->initDB();
if ($this->isValidWorker() == false) {
echo "Not valid worker";
exit(1);
} else {
$this->insert("UPDATE Worker SET lastRequestTime = now() WHERE apiKey = {$this->apiKey}");
}
parent::__construct($request);
}
示例12: __construct
public function __construct($request, $origin)
{
// call parent constructor
parent::__construct($request);
$Users = new Users();
$PersonalEmail = new PersonalEmail();
$GlobalEmail = new GlobalEmail();
$Notifications = new Notifications();
$this->Users = $Users;
$this->PersonalEmail = $PersonalEmail;
$this->GlobalEmail = $GlobalEmail;
$this->Notifications = $Notifications;
}
示例13:
function __construct()
{
parent::__construct();
$this->auth_dir = $this->get_output_dir('flickr/auth');
$this->frobfile = $this->auth_dir . '/frob.txt';
$this->tokenfile = $this->auth_dir . '/token.txt';
// warning: stored in libapi data dir - should store locally, or set read permissions?
if (file_exists($this->tokenfile)) {
$this->token = file_get_contents($this->tokenfile);
}
if (!$this->token) {
$this->get_token();
}
}
示例14: __construct
/**
* Constructor: __construct
* Call parent construct and connect to database
*/
public function __construct($request, $origin)
{
parent::__construct($request);
try {
$servername = "localhost";
$username = "restapi-assignme";
$password = "yXydwAJSR8VaWtZr";
$myDB = "restapi-assignment";
$this->conn = new PDO("mysql:host={$servername};dbname={$myDB}", $username, $password);
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo json_encode(array('error' => $e->getMessage()));
}
}
示例15: __construct
public function __construct($configuration_file_name)
{
if (PHP_SAPI == 'cli') {
global $argv;
parent::__construct(API::FRONTEND_FASTCGI);
} else {
parent::__construct(API::FRONTEND_BASIC);
}
$this->initializeConfiguration($configuration_file_name);
if (method_exists($this, 'routeMap')) {
parent::registerCommonRequestHandler($this, 'initializeDynamicRouteTable');
}
// Left for compatibility
$this->sd = $this->ats = $this;
}