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


PHP xPDO::getInstance方法代码示例

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


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

示例1:

 /**
  * Grab a persistent instance of the xPDO class to share sample model data
  * across multiple tests and test suites.
  *
  * @param boolean $new Indicate if a new singleton should be created
  * @return xPDO An xPDO object instance.
  */
 public static function &getInstance($new = false)
 {
     if ($new || !is_object(xPDOTestHarness::$xpdo)) {
         $driver = xPDOTestHarness::$properties['xpdo_driver'];
         $xpdo = xPDO::getInstance(null, xPDOTestHarness::$properties["{$driver}_array_options"]);
         if (is_object($xpdo)) {
             $logLevel = array_key_exists('logLevel', xPDOTestHarness::$properties) ? xPDOTestHarness::$properties['logLevel'] : xPDO::LOG_LEVEL_WARN;
             $logTarget = array_key_exists('logTarget', xPDOTestHarness::$properties) ? xPDOTestHarness::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
             $xpdo->setLogLevel($logLevel);
             $xpdo->setLogTarget($logTarget);
             if (!empty(xPDOTestHarness::$debug)) {
                 $xpdo->setDebug(xPDOTestHarness::$properties['debug']);
             }
             $xpdo->setPackage('sample', xPDOTestHarness::$properties['xpdo_test_path'] . 'model/');
             xPDOTestHarness::$xpdo = $xpdo;
         }
     }
     return xPDOTestHarness::$xpdo;
 }
开发者ID:christianseel,项目名称:xpdo,代码行数:26,代码来源:xPDOTestHarness.php

示例2: set_time_limit

/**
 * Slackify package builder
 *
 * @author Ivan Klimchuk <ivan@klimchuk.com>
 * @package slackNotify
 * @subpackage build
 */
set_time_limit(0);
ini_set('date.timezone', 'Europe/Minsk');
define('PKG_NAME', 'Slackify');
define('PKG_NAME_LOWER', strtolower(PKG_NAME));
define('PKG_VERSION', '0.8.1');
define('PKG_RELEASE', 'pl');
require_once 'xpdo/xpdo/xpdo.class.php';
require_once 'xpdo/xpdo/transport/xpdotransport.class.php';
$xpdo = xPDO::getInstance('db', [xPDO::OPT_CACHE_PATH => __DIR__ . '/../cache/', xPDO::OPT_HYDRATE_FIELDS => true, xPDO::OPT_HYDRATE_RELATED_OBJECTS => true, xPDO::OPT_HYDRATE_ADHOC_FIELDS => true, xPDO::OPT_CONNECTIONS => [['dsn' => 'mysql:host=localhost;dbname=xpdotest;charset=utf8', 'username' => 'test', 'password' => 'test', 'options' => [xPDO::OPT_CONN_MUTABLE => true], 'driverOptions' => []]]]);
$xpdo->setLogLevel(xPDO::LOG_LEVEL_INFO);
$xpdo->setLogTarget();
class modNamespace extends xPDOObject
{
}
class modCategory extends xPDOObject
{
    public function getFKDefinition($alias)
    {
        $aggregates = ['Plugins' => ['class' => 'modPlugin', 'local' => 'id', 'foreign' => 'category', 'cardinality' => 'many', 'owner' => 'local']];
        return isset($aggregates[$alias]) ? $aggregates[$alias] : [];
    }
}
class modSystemSetting extends xPDOObject
{
开发者ID:doksec,项目名称:modx-slackify,代码行数:31,代码来源:build.transport.php

示例3: header

$_SESSION['user'] = 1;
if (!isset($_SESSION['user'])) {
    if (!$_REQUEST['xoadCall']) {
        header('location: login.php');
    } else {
        echo 'SESSION_TIME_EXPIRED';
        die;
    }
}
require_once 'inc/core/helpers.php';
require_once 'conf/init.php';
require_once xConfig::get('PATH', 'CORE') . 'core.php';
require_once xConfig::get('PATH', 'CORE') . 'helpers.tpl.php';
xRegistry::set('TMS', $TMS = new tMultiSection());
xPDO::setSource(DB_HOST, DB_NAME, DB_USER, DB_PASS);
xRegistry::set('xPDO', xPDO::getInstance());
xNameSpaceHolder::addObjectToNS('E', new ENHANCE());
require_once xConfig::get('PATH', 'XOAD') . 'xoad.php';
require_once xConfig::get('PATH', 'ADM') . 'logger.class.php';
require_once xConfig::get('PATH', 'ADM') . 'adm.class.php';
if ($_REQUEST['xoadCall']) {
    ob_start();
    $adm = new adminPanel();
    $adm->startMapping();
    if (XOAD_Server::runServer()) {
        $all = ob_get_contents();
        ob_end_clean();
        if ($_COMMON_SITE_CONF['output_html_compress']) {
            Common::compress_output($all);
        }
        echo $all;
开发者ID:umaxfun,项目名称:x4m,代码行数:31,代码来源:admin.php


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