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


PHP Bootstrap::import方法代码示例

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


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

示例1: Exception

<?php

Bootstrap::import('nl.bransom.Config');
/**
 * Description of DbConnection
 *
 * @author Rob Bosman
 */
class DbConnection
{
    private $mysqli;
    function __construct($schemaName)
    {
        $config = Config::getInstance();
        $configDb = $config->getSection('db');
        if (!isset($configDb['hostName']) or !isset($configDb['userName']) or !isset($configDb['password'])) {
            throw new Exception("Config error: please specify properties 'hostName', 'userName' and 'password'" . " in section [db].");
        }
        $hostName = $configDb['hostName'];
        $userName = $configDb['userName'];
        $password = $configDb['password'];
        $mysqli = new mysqli($hostName, $userName, $password, $schemaName);
        // check if connection has been made successfully
        if (mysqli_connect_errno()) {
            throw new Exception("Error connecting to database '{$userName}@{$hostName}' - " . mysqli_connect_error());
        }
        $mysqli->query('SET NAMES \'UTF8\'');
        $this->mysqli = $mysqli;
    }
    function __destruct()
    {
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:DbConnection.class.php

示例2: __construct

<?php

Bootstrap::import('nl.bransom.rest.RestUrlParams');
Bootstrap::import('nl.bransom.persistency.meta.Entity');
/**
 * Description of QueryContext
 *
 * @author Rob Bosman
 */
class QueryContext
{
    const ALL_TIMES = 'All_TIMES';
    private $at;
    private $published;
    private $queryParamsMap;
    private $scopeMap;
    public function __construct(array $params, $mainEntity)
    {
        $this->at = RestUrlParams::parseTimestamp(RestUrlParams::extractValue($params, RestUrlParams::AT));
        if ($this->at == RestUrlParams::ALL_TIMES) {
            $this->at = self::ALL_TIMES;
        }
        $this->published = RestUrlParams::parseBoolean(RestUrlParams::extractValue($params, RestUrlParams::PUBLISHED));
        $this->queryParamsMap = array();
        $this->scopeMap = array();
        if ($mainEntity != NULL) {
            foreach ($params as $paramName => $paramValue) {
                // Parameters can be specified with or without entity-prefix, e.g. 'entity/property=value' or just
                // 'property=value'. Check if an entity-prefix is provided.
                $entityName = NULL;
                $propertyName = NULL;
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:QueryContext.class.php

示例3: realpath

<?php

require_once realpath(dirname(__FILE__) . '/php/Bootstrap.class.php');
Bootstrap::initConfig(dirname(__FILE__) . '/config/config.ini');
Bootstrap::import('nl.bransom.persistency.meta.MetaData');
$metaData = MetaData::getInstance();
$appNames = $metaData->getAppNames();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<title>REST applications</title>
	</head>
	<body>
		<h3>REST applications</h3>
		<table>
			<?php 
foreach ($appNames as $appName) {
    ?>
				<tr><td colspan="2"><a href="REST/<?php 
    echo $appName;
    ?>
"><b><?php 
    echo $appName;
    ?>
</b></a></td></tr>
				<tr>
					<td>&nbsp;</td>
					<td>schema = <?php 
    echo $metaData->getSchema($appName)->getName();
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:bransom.php

示例4: error_reporting

<?php

error_reporting(E_ALL | E_NOTICE | E_WARNING);
//$DEBUG_PROXY = 'localhost:8888';
require_once dirname(__FILE__) . '/../php/Bootstrap.class.php';
Bootstrap::initConfig(dirname(__FILE__) . '/../config/config.ini');
Bootstrap::import('nl.bransom.persistency.DbConnection');
class TestEngine
{
    public static function _createDatabaseSchema($schemaName)
    {
        $dbConnection = new DbConnection(NULL);
        $mySQLi = $dbConnection->getMySQLi();
        $queryResult = $mySQLi->multi_query("DROP DATABASE IF EXISTS `{$schemaName}`;" . "CREATE DATABASE IF NOT EXISTS `{$schemaName}`;");
        if (!$queryResult) {
            throw new Exception("Error creating database '{$schemaName}' - " . $mySQLi->error);
        }
        $queryResult->close();
    }
    public static function createDatabaseSchema($schemaName)
    {
        $dbConnection = new DbConnection(NULL);
        $mySQLi = $dbConnection->getMySQLi();
        $queryResult = $mySQLi->query("DROP DATABASE IF EXISTS `{$schemaName}`");
        if ($queryResult === FALSE) {
            throw new Exception("Error creating database '{$schemaName}' - " . $mySQLi->error);
        }
        $queryResult = $mySQLi->query("CREATE DATABASE IF NOT EXISTS `{$schemaName}`");
        if ($queryResult === FALSE) {
            throw new Exception("Error creating database '{$schemaName}' - " . $mySQLi->error);
        }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:TestEngine.class.php

示例5: getSignedInAccountId

<?php

Bootstrap::import('nl.bransom.Config');
Bootstrap::import('nl.bransom.auth.OpenIDConnect.OpenIDConnectHandler');
Bootstrap::import('nl.bransom.auth.HTPasswordHandler');
Bootstrap::startSession();
/**
 * Description of AuthHandler
 *
 * @author Rob Bosman
 */
class AuthHandler
{
    public static function getSignedInAccountId($appName, &$jwt = NULL)
    {
        $authModelPropertyName = 'authentication-model-for-app.' . $appName;
        $authModel = self::getAuthModel($authModelPropertyName);
        if ($authModel === NULL) {
            throw new Exception("Config error: please specify property '{$authModelPropertyName}' in section [auth].");
        }
        if (strcasecmp($authModel, 'OpenIDConnect') == 0) {
            $handler = new OpenIDConnectHandler($appName);
            return $handler->getSignedInAccountId($jwt);
        } else {
            if (strcasecmp($authModel, 'HTPassword') == 0) {
                return HTPasswordHandler::getSignedInAccountId();
            } else {
                if (strcasecmp($authModel, 'NONE') == 0 || $authModel == '') {
                    return 1;
                } else {
                    throw new Exception("Config error: unexpected value for property {$authModelPropertyName}: '{$authModel}'.");
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:AuthHandler.class.php

示例6: getInstance

<?php

Bootstrap::import('nl.bransom.Config');
Bootstrap::import('nl.bransom.persistency.meta.Schema');
/**
 * Description of MetaData
 *
 * @author Rob Bosman
 */
class MetaData
{
    private static $instance;
    public static function getInstance()
    {
        if (!isset(MetaData::$instance)) {
            MetaData::$instance = new MetaData();
        }
        return MetaData::$instance;
    }
    private $appSchemaMap;
    private $appNamespaceUriMap;
    private $appContextRootMap;
    private function __construct()
    {
        $this->appSchemaMap = array();
        $this->appNamespaceUriMap = array();
        $this->appContextRootMap = array();
        $config = Config::getInstance();
        foreach ($config->getSection('db') as $propertyId => $value) {
            $prefix = 'schema-for-app.';
            if (strpos($propertyId, $prefix) === 0) {
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:MetaData.class.php

示例7: handleFatalErrorsOnShutdown

<?php

Bootstrap::import('nl.bransom.http.HttpResponseCodes');
Bootstrap::import('nl.bransom.http.InternetMediaTypes');
/**
 * Description of HttpResponder
 *
 * @author Rob Bosman
 */
class HttpResponder
{
    private static $isShutdownHandlerEnabled = FALSE;
    public static function handleFatalErrorsOnShutdown()
    {
        // Intercept any fatal error and start buffering all output to prevent fatal errors form being echoed
        // prematurely.
        register_shutdown_function('HttpResponder::handleFatalError');
        ob_start();
        self::$isShutdownHandlerEnabled = TRUE;
    }
    public static function handleFatalError()
    {
        if (self::$isShutdownHandlerEnabled === TRUE) {
            $errorMessage = ob_get_clean();
            error_log("FATAL ERROR - {$errorMessage}");
            self::respond(HttpResponseCodes::HTTP_INTERNAL_SERVER_ERROR, $errorMessage, 'text/html');
        }
    }
    public static function respond($httpResponseCode, $errorDetails = NULL, $contentType = NULL)
    {
        self::$isShutdownHandlerEnabled = FALSE;
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:HttpResponder.class.php

示例8: realpath

<?php

require_once realpath(dirname(__FILE__) . '/../../../bransom/php/Bootstrap.class.php');
Bootstrap::initConfig(dirname(__FILE__) . '/../../../bransom/config/config.ini');
Bootstrap::import('nl.bransom.http.HttpRequestHandler');
session_start();
$xmlUrl = $_POST['xmlUrl'];
$siteId = $_POST['site/id'];
$siteName = $_POST['site/name'];
$itemsetName = $_POST['itemset/name'];
// Download the XML and report any error.
error_reporting(E_ERROR);
$downloadedXml = new DOMDocument();
$downloadedXml->load($xmlUrl);
$lastError = error_get_last();
if ($lastError != NULL) {
    echo '<h1>Error</h1>' . $lastError['message'];
    exit;
}
error_reporting(E_ALL);
// Apply the style sheet to the downloaded XML.
$xslDoc = new DOMDocument();
$xslDoc->load('import.xsl');
$xsltProc = new XSLTProcessor();
$xsltProc->setParameter('', 'base-url', substr($xmlUrl, 0, strrpos($xmlUrl, '/')) . '/');
$xsltProc->setParameter('', 'site-id', $siteId);
$xsltProc->setParameter('', 'site-name', $siteName);
$xsltProc->setParameter('', 'itemset-name', $itemsetName);
$xsltProc->importStylesheet($xslDoc);
$dataXml = $xsltProc->transformToXML($downloadedXml);
// Convert image URL's to Base64 data.
开发者ID:RobBosman,项目名称:vanace.WebItems,代码行数:31,代码来源:import.php

示例9: getParsedObjects

<?php

Bootstrap::import('nl.bransom.persistency.ObjectFetcher');
Bootstrap::import('nl.bransom.persistency.meta.ObjectEntity');
Bootstrap::import('nl.bransom.persistency.meta.Schema');
Bootstrap::import('nl.bransom.rest.ParsedObject');
Bootstrap::import('nl.bransom.rest.TemporaryIdMap');
/**
 * Description of RestParser
 *
 * @author Rob Bosman
 */
class RestParser
{
    private $parsedObjects;
    private $createdObjects;
    private $changedObjects;
    private $deletedObjects;
    private $touchedObjects;
    private $publishedObjects;
    function __construct()
    {
        $this->parsedObjects = array();
        $this->createdObjects = array();
        $this->changedObjects = array();
        $this->deletedObjects = array();
        $this->touchedObjects = array();
        $this->publishedObjects = array();
    }
    public function getParsedObjects()
    {
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:RestParser.class.php

示例10: publish

<?php

Bootstrap::import('nl.bransom.Audit');
Bootstrap::import('nl.bransom.persistency.ObjectRef');
Bootstrap::import('nl.bransom.persistency.QueryEntity');
Bootstrap::import('nl.bransom.persistency.meta.Entity');
Bootstrap::import('nl.bransom.persistency.meta.Property');
Bootstrap::import('nl.bransom.persistency.meta.Schema');
Bootstrap::import('nl.bransom.persistency.Scope');
Bootstrap::import('nl.bransom.persistency.XmlConstants');
/**
 * Description of ObjectPublisher
 *
 * @author Rob Bosman
 */
class ObjectPublisher
{
    public function publish(Schema $schema, Entity $entity, $id, Audit $audit)
    {
        $this->unpublishObject($schema, $entity, $id);
        return $this->publishObject($schema, $entity, $id, $audit);
    }
    public function unpublishObject(Schema $schema, ObjectEntity $entity, $id)
    {
        $numUnpublished = 0;
        $mySQLi = $schema->getMySQLi();
        // Find any related objects that are (still) published.
        $ownedObjectRefs = $this->getOwnedObjectRefs($schema, $entity, $id, TRUE);
        if ($entity->getStateIdColumnName() != NULL) {
            // Unpublish the object at hand.
            $entityName = $entity->getName();
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:ObjectPublisher.class.php

示例11: __autoload

<?php

require_once 'define.php';
require_once CONFIG_PATH . 'config.php';
date_default_timezone_set($config['time_zone']);
function __autoload($classname)
{
    require_once LIBRARY_PATH . $classname . '.php';
}
Session::init();
$imports = $config['import'];
$app = new Bootstrap();
$app->import($imports);
$app->run();
开发者ID:noikiy,项目名称:lovetolove,代码行数:14,代码来源:index.php

示例12: __construct

<?php

Bootstrap::import('nl.bransom.auth.OpenIDConnect.HttpUtil');
Bootstrap::import('nl.bransom.auth.OpenIDConnect.OpenIDTokenVerifier');
Bootstrap::import('nl.bransom.auth.OpenIDConnect.SessionCache');
/**
 * Description of OpenIDContext
 *
 * @author RobB
 */
class OpenIDConnect
{
    const OPENID_CONFIG_URL_KEY = 'https://accounts.google.com/.well-known/openid-configuration';
    const OPENID_CONFIG_AUTH_ENDPOINT_KEY = 'authorization_endpoint';
    const OPENID_CONFIG_TOKEN_ENDPOINT_KEY = 'token_endpoint';
    const OPENID_CONFIG_JWKS_URI_KEY = 'jwks_uri';
    private static $ANTI_FORGERY_STATE_TOKEN_CACHE_KEY = array('id' => 'AntiForgeryStateToken', 'exp' => 600);
    // 10 minutes
    private static $OPENID_CONFIG_CACHE_KEY = array('id' => 'OpenIDConfig', 'exp' => 3600);
    // 1 hours
    private static $JWKS_CACHE_KEY = array('id' => 'JWKS', 'exp' => 3600);
    // 1 hours
    private static $PARKED_JWT_CACHE_KEY = array('id' => 'ParkedJWT', 'exp' => 10);
    // 10 seconds
    private $clientId;
    private $clientSecret;
    public function __construct($clientId, $clientSecret)
    {
        $this->clientId = $clientId;
        $this->clientSecret = $clientSecret;
    }
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:OpenIDConnect.class.php

示例13: __construct

<?php

Bootstrap::import('nl.bransom.persistency.Query');
Bootstrap::import('nl.bransom.persistency.Scope');
Bootstrap::import('nl.bransom.persistency.meta.Entity');
Bootstrap::import('nl.bransom.persistency.meta.Property');
/**
 * Description of QueryEntity
 *
 * @author Rob Bosman
 */
class QueryEntity extends Query
{
    const ID_CREATED = 'ID_CREATED';
    const ID_TERMINATED = 'ID_TERMINATED';
    const ID_PUBLISHED = 'ID_PUBLISHED';
    private $searchEntity;
    private $queryParams;
    private $propertyNames;
    private $scope;
    private $skipBinaries;
    public function __construct(Entity $searchEntity, QueryContext $queryContext, Scope $defaultScope, $id = NULL, $skipBinaries = FALSE)
    {
        parent::__construct($queryContext);
        $this->searchEntity = $searchEntity;
        $this->queryParams = $queryContext->getQueryParameters($searchEntity, $id);
        $this->propertyNames = array();
        $this->scope = $queryContext->getScope($searchEntity, $defaultScope);
        $this->skipBinaries = $skipBinaries;
        // If the scope doesn't include property values...
        if ($this->scope->includes(Scope::TAG_PROPERTIES) == Scope::INCLUDES_NONE) {
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:QueryEntity.class.php

示例14: __construct

<?php

Bootstrap::import('nl.bransom.persistency.meta.Entity');
Bootstrap::import('nl.bransom.persistency.meta.Relationship');
/**
 * Description of OneToManyRelationship
 *
 * @author Rob Bosman
 */
class OneToManyRelationship extends Relationship
{
    public function __construct(Entity $fkEntity, $fkColumnName, Entity $otherEntity, Entity $ownerEntity)
    {
        parent::__construct($fkEntity, array($fkColumnName => $otherEntity), $ownerEntity);
    }
}
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:16,代码来源:OneToManyRelationship.class.php

示例15: QueryContext

<?php

Bootstrap::import('nl.bransom.Audit');
Bootstrap::import('nl.bransom.persistency.ObjectPublisher');
Bootstrap::import('nl.bransom.persistency.QueryEntity');
Bootstrap::import('nl.bransom.persistency.meta.Entity');
Bootstrap::import('nl.bransom.persistency.meta.ObjectEntity');
Bootstrap::import('nl.bransom.persistency.meta.Property');
Bootstrap::import('nl.bransom.persistency.meta.Schema');
Bootstrap::import('nl.bransom.persistency.Scope');
/**
 * Description of ObjectModifier
 *
 * @author Rob Bosman
 */
class ObjectModifier
{
    private $objectPublisher;
    private $defaultQueryContext;
    function __construct(ObjectPublisher $objectPublisher)
    {
        $this->objectPublisher = $objectPublisher;
        $this->defaultQueryContext = new QueryContext(array(), NULL);
    }
    /**
     * Inserts a new object in the database and returns the newly created ID.
     *
     * @param Schema $schema
     * @param ObjectEntity $entity
     * @param array $content
     * @param Audit $audit
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:31,代码来源:ObjectModifier.class.php


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