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


PHP modX::initialize方法代码示例

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


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

示例1: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $this->utHelpers = new UtHelpers();
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->mc->createCategories();
     $this->mc->createBasics();
     $this->modx =& $this->mc->modx;
     if ($this->mc->props['categories']['UnitTest']['category'] != 'UnitTest') {
         die('wrong config');
     }
     if (strstr($this->mc->targetRoot, 'unittest')) {
         // $this->utHelpers->rrmdir($this->mc->targetRoot);
     } else {
         die('Wrong Target Root!');
     }
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:29,代码来源:exporttest.php

示例2: loadModxInstance

 public static function loadModxInstance()
 {
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     echo XPDO_CLI_MODE ? '' : '<pre>';
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
     $modx->loadClass('transport.modPackageBuilder', '', false, true);
     return $modx;
 }
开发者ID:kondakovdm,项目名称:fastuploadtv,代码行数:11,代码来源:build.tools.php

示例3: initialize

 public function initialize($contextKey = 'web', $options = null)
 {
     parent::initialize($contextKey, $options);
     $corePath = $this->getOption('subdomainsfolder_core_path', null, $this->getOption('core_path', null, MODX_CORE_PATH) . 'components/subdomainsfolder/');
     $this->SubdomainsFolder = $this->getService('SubdomainsFolder', 'SubdomainsFolder', $corePath . 'model/subdomainsfolder/');
     if ($this->SubdomainsFolder) {
         $this->SubdomainsFolder->initialize($this->context->key);
         $this->domains = $this->SubdomainsFolder->Tools->getDomains();
     } else {
         $this->log(modX::LOG_LEVEL_ERROR, 'modModX requires installed SubdomainsFolder.');
     }
 }
开发者ID:vgrish,项目名称:subdomainsfolder,代码行数:12,代码来源:modmodx.class.php

示例4: _getConnection

 /**
  * Grab a persistent instance of the xPDO class to share connection data
  * across multiple tests and test suites.
  * 
  * @param array $options An array of configuration parameters.
  * @return xPDO An xPDO object instance.
  */
 public static function _getConnection($options = array())
 {
     $modx = FiTestHarness::$modx;
     if (is_object($modx)) {
         if (!$modx->request) {
             $modx->getRequest();
         }
         if (!$modx->error) {
             $modx->request->loadErrorHandler();
         }
         $modx->error->reset();
         FiTestHarness::$modx = $modx;
         return FiTestHarness::$modx;
     }
     /* include config.core.php */
     $properties = array();
     $config = array();
     include strtr(realpath(dirname(__FILE__)) . '/config.inc.php', '\\', '/');
     require_once $config['modx_base_path'] . 'config.core.php';
     require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     include_once strtr(realpath(dirname(__FILE__)) . '/properties.inc.php', '\\', '/');
     if (!defined('MODX_REQP')) {
         define('MODX_REQP', false);
     }
     $modx = new modX(null, $properties);
     $ctx = !empty($options['ctx']) ? $options['ctx'] : 'web';
     $modx->initialize($ctx);
     $debug = !empty($options['debug']);
     $modx->setDebug($debug);
     if (!empty($properties['logTarget'])) {
         $modx->setLogTarget($properties['logTarget']);
     }
     if (!empty($properties['logLevel'])) {
         $modx->setLogLevel($properties['logLevel']);
     }
     $modx->user = $modx->newObject('modUser');
     $modx->user->set('id', $modx->getOption('modx.test.user.id', null, 1));
     $modx->user->set('username', $modx->getOption('modx.test.user.username', null, 'test'));
     $modx->getRequest();
     $modx->getParser();
     $modx->request->loadErrorHandler();
     @error_reporting(E_ALL);
     @ini_set('display_errors', true);
     FiTestHarness::$modx = $modx;
     return $modx;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:54,代码来源:FiTestHarness.php

示例5: loadMODX

 /**
  * Loads a new modX instance
  *
  * @throws \RuntimeException
  * @return \modX
  */
 public static function loadMODX()
 {
     if (self::$modx) {
         return self::$modx;
     }
     if (!file_exists(GITIFY_WORKING_DIR . 'config.core.php')) {
         throw new \RuntimeException('There does not seem to be a MODX installation here. ');
     }
     require_once GITIFY_WORKING_DIR . 'config.core.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new \modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $modx->setLogTarget('ECHO');
     self::$modx = $modx;
     return $modx;
 }
开发者ID:krismas,项目名称:Gitify,代码行数:23,代码来源:Gitify.php

示例6: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before each test is executed.
  */
 protected function setUp()
 {
     // echo "\n---------------- SETUP --------------------";
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $this->utHelpers = new UtHelpers();
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $modx->getService('lexicon', 'modLexicon');
     $modx->getRequest();
     $homeId = $modx->getOption('site_start');
     $homeResource = $modx->getObject('modResource', $homeId);
     if ($homeResource instanceof modResource) {
         $modx->resource = $homeResource;
     } else {
         echo "\nNo Resource\n";
     }
     $modx->setLogLevel(modX::LOG_LEVEL_ERROR);
     $modx->setLogTarget('ECHO');
     require_once MODX_ASSETS_PATH . 'mycomponents/mycomponent/core/components/mycomponent/model/mycomponent/mycomponentproject.class.php';
     /* @var $categoryObj modCategory */
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->modx =& $modx;
     $this->category = key($this->mc->props['categories']);
     $this->packageNameLower = $this->mc->packageNameLower;
     if ($this->category != 'UnitTest') {
         session_write_close();
         die('wrong config - NEVER run unit test on a real project!');
     }
     $category = $this->modx->getCollection('modCategory', array('category' => 'UnitTest'));
     foreach ($category as $categoryObj) {
         $categoryObj->remove();
     }
     $namespace = $this->modx->getObject('modNamespace', array('name' => 'unittest'));
     if ($namespace) {
         $namespace->remove();
     }
     $this->utHelpers->rrmdir($this->mc->targetRoot);
     $this->utHelpers->removeElements($this->modx, $this->mc);
     $this->utHelpers->removeResources($this->modx, $this->mc);
     //$this->mc->createCategory();
     //$this->mc->createNamespace();
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:50,代码来源:bootstraptest.php

示例7: _getConnection

 /**
  * Grab a persistent instance of the xPDO class to share connection data
  * across multiple tests and test suites.
  * 
  * @param array $options An array of configuration parameters.
  * @return xPDO An xPDO object instance.
  */
 public static function _getConnection($options = array())
 {
     if (is_object(MODxTestHarness::$modx)) {
         return MODxTestHarness::$modx;
     }
     /* include config.core.php */
     $properties = array();
     require_once strtr(realpath(dirname(dirname(dirname(__FILE__)))) . '/config.core.php', '\\', '/');
     require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     include_once strtr(realpath(dirname(__FILE__)) . '/properties.inc.php', '\\', '/');
     $modx = new modX(null, $properties);
     $ctx = !empty($options['ctx']) ? $options['ctx'] : 'web';
     $modx->initialize($ctx);
     $debug = !empty($options['debug']);
     $modx->setDebug($debug);
     $modx->user = $modx->newObject('modUser');
     $modx->user->set('id', $modx->getOption('modx.test.user.id', 1));
     $modx->user->set('username', $modx->getOption('modx.test.user.username', 'test'));
     MODxTestHarness::$modx = $modx;
     return $modx;
 }
开发者ID:JoeBlow,项目名称:revolution,代码行数:29,代码来源:MODxTestHarness.php

示例8: dirname

<?php

if (!defined('MODX_BASE_PATH')) {
    require 'build.config.php';
}
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 'model' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/', 'schema' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/schema/', 'xml' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/schema/' . PKG_NAME_LOWER . '.mysql.schema.xml');
unset($root);
require MODX_CORE_PATH . 'model/modx/modx.class.php';
require $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->getService('error', 'error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
    echo '<pre>';
}
/** @var xPDOManager $manager */
$manager = $modx->getManager();
/** @var xPDOGenerator $generator */
$generator = $manager->getGenerator();
// Remove old model
rrmdir($sources['model'] . PKG_NAME_LOWER . '/mysql');
// Generate a new one
$generator->parseSchema($sources['xml'], $sources['model']);
$modx->log(modX::LOG_LEVEL_INFO, 'Model generated.');
if (!XPDO_CLI_MODE) {
    echo '</pre>';
开发者ID:bendasvadim,项目名称:VoteForms,代码行数:31,代码来源:build.model.php

示例9: modX

<?php

// setting up modx access
require_once '/PATH_TO_MODX/config.core.php';
require_once '/PATH_TO_MODX_CORE/model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error', 'error.modError');
// define locations  UPDATE BEFORE USING!
// base file path to where static files will be saved
$basepath = '/FULL_SERVER_PATH/public_html/';
// url to your modx install
$mdxurl = 'http://URL-TO-MODX-INSTALL/';
// - - - - - - - - - end configuration - - - - - - - - -
// getting the published ids
// get collection of resources, determine id and if published
$docs = $modx->getCollection('modResource');
foreach ($docs as $doc) {
    $pub = $doc->get('published');
    $folder = $doc->get('isfolder');
    $rid = $doc->get('id');
    $web_url = $doc->get('uri');
    // if published, fetch url and build static webpage
    if ($pub == '1' && $folder == '0') {
        // determine if folders exist and create if not
        $path_parts = pathinfo($basepath . $web_url);
        $target_path = $path_parts['dirname'];
        if (!file_exists($target_path)) {
            mkdir($target_path, 0755, true);
        }
        // get the webpage from MODX
开发者ID:mrcycling,项目名称:vandergraaf-M,代码行数:31,代码来源:vandergraaf-M.php

示例10: modX

@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(dirname(__FILE__)) . '/core/');
if (!include_once(MODX_CORE_PATH . 'model/modx/modx.class.php')) die();

/* instantiate the modX class with the appropriate configuration */
if (empty($options) || !is_array($options)) $options = array();
$modx= new modX('', $options);

/* set debugging/logging options */
//$modx->setDebug(E_ALL & ~E_NOTICE);
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
//$modx->setLogTarget('FILE');

/* initialize the proper context */
$ctx = isset($_REQUEST['ctx']) && !empty($_REQUEST['ctx']) ? $_REQUEST['ctx'] : 'mgr';
$modx->initialize($ctx);

if (defined('MODX_REQP') && MODX_REQP === false) {
} else if (!$modx->context->checkPolicy('load')) {
    @session_write_close();
    die();
}

if ($ctx == 'mgr') {
    $ml = $modx->getOption('manager_language',null,'en');
    if ($ml != 'en') {
        $modx->lexicon->load($ml.':core:default');
        $modx->setOption('cultureKey',$ml);
    }
}
开发者ID:ncrossland,项目名称:revolution,代码行数:30,代码来源:index.php

示例11: array

 /**
  * Create or grab a reference to a static xPDO/modX instance.
  *
  * The instances can be reused by multiple tests and test suites.
  *
  * @param string $class A fixture class to get an instance of.
  * @param string $name A unique identifier for the fixture.
  * @param boolean $new
  * @param array $options An array of configuration options for the fixture.
  * @return object|null An instance of the specified fixture class or null on failure.
  */
 public static function &getFixture($class, $name, $new = false, array $options = array())
 {
     if (!$new && array_key_exists($name, self::$fixtures) && self::$fixtures[$name] instanceof $class) {
         $fixture =& self::$fixtures[$name];
     } else {
         $properties = array();
         include_once dirname(dirname(dirname(__FILE__))) . '/core/model/modx/modx.class.php';
         include dirname(__FILE__) . '/properties.inc.php';
         self::$properties = $properties;
         if (array_key_exists('debug', self::$properties)) {
             self::$debug = (bool) self::$properties['debug'];
         }
         $fixture = null;
         $driver = self::$properties['xpdo_driver'];
         switch ($class) {
             case 'modX':
                 if (!defined('MODX_REQP')) {
                     define('MODX_REQP', false);
                 }
                 if (!defined('MODX_CONFIG_KEY')) {
                     define('MODX_CONFIG_KEY', array_key_exists('config_key', self::$properties) ? self::$properties['config_key'] : 'test');
                 }
                 $fixture = new modX(null, self::$properties["{$driver}_array_options"]);
                 if ($fixture instanceof modX) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : modX::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                     $fixture->initialize(self::$properties['context']);
                     $fixture->user = $fixture->newObject('modUser');
                     $fixture->user->set('id', $fixture->getOption('modx.test.user.id', null, 1));
                     $fixture->user->set('username', $fixture->getOption('modx.test.user.username', null, 'test'));
                     $fixture->getRequest();
                     $fixture->getParser();
                     $fixture->request->loadErrorHandler();
                 }
                 break;
             case 'xPDO':
                 $fixture = new xPDO(self::$properties["{$driver}_string_dsn_test"], self::$properties["{$driver}_string_username"], self::$properties["{$driver}_string_password"], self::$properties["{$driver}_array_options"], self::$properties["{$driver}_array_driverOptions"]);
                 if ($fixture instanceof xPDO) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : xPDO::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                 }
                 break;
             default:
                 $fixture = new $class($options);
                 break;
         }
         if ($fixture !== null && $fixture instanceof $class) {
             self::$fixtures[$name] = $fixture;
         } else {
             die("Error setting fixture {$name} of expected class {$class}.");
         }
     }
     return $fixture;
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:75,代码来源:MODxTestHarness.php

示例12: array

 include MODX_CORE_PATH . 'model/modx/modx.class.php';
 if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
     set_time_limit(0);
 }
 $options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $startTime) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
 $modx = new modX('', $options);
 $modx->setLogTarget($options['log_target']);
 $modx->setLogLevel($options['log_level']);
 $modx->setOption(xPDO::OPT_CACHE_DB, false);
 $modx->setOption(xPDO::OPT_SETUP, true);
 $modx->setDebug(-1);
 $modx->startTime = $startTime;
 $modx->getVersionData();
 $modxVersion = $modx->version['full_version'];
 if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
     $modx->initialize('mgr', $options);
 } else {
     $modx->initialize('mgr');
 }
 if (!$modx->hasPermission('Vapor')) {
     die('Access denied');
 }
 $modx->setLogTarget($options['log_target']);
 $modx->setLogLevel($options['log_level']);
 $modx->setOption(xPDO::OPT_CACHE_DB, false);
 $modx->setOption(xPDO::OPT_SETUP, true);
 $modx->setDebug(-1);
 $modxDatabase = $modx->getOption('dbname', $options, $modx->getOption('database', $options));
 $modxTablePrefix = $modx->getOption('table_prefix', $options, '');
 $core_path = realpath($modx->getOption('core_path', $options, MODX_CORE_PATH)) . '/';
 $assets_path = realpath($modx->getOption('assets_path', $options, MODX_ASSETS_PATH)) . '/';
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:31,代码来源:vapor.php

示例13: setUp

 protected function setUp()
 {
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $this->utHelpers = new UtHelpers();
     $modx = new modX();
     $this->modx =& $modx;
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $modx->getService('lexicon', 'modLexicon');
     $modx->getRequest();
     $homeId = $modx->getOption('site_start');
     $homeResource = $modx->getObject('modResource', $homeId);
     if ($homeResource instanceof modResource) {
         $modx->resource = $homeResource;
     } else {
         echo "\nNo Resource\n";
     }
     $modx->setLogLevel(modX::LOG_LEVEL_ERROR);
     $modx->setLogTarget('ECHO');
     require_once MODX_ASSETS_PATH . 'mycomponents/mycomponent/core/components/mycomponent/model/mycomponent/mycomponentproject.class.php';
     require_once MODX_ASSETS_PATH . 'mycomponents/mycomponent/core/components/mycomponent/model/mycomponent/lexiconcodefile.class.php';
     /* @var $categoryObj modCategory */
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->dataDir = dirname(__FILE__) . '/data/';
     $this->dataDir = str_replace('\\', '/', $this->dataDir);
     $this->targetRoot = dirname(dirname(dirname(dirname(__FILE__)))) . '/unittest/';
     $this->targetRoot = str_replace('\\', '/', $this->targetRoot);
     $this->targetRoot = strtolower($this->targetRoot);
     $this->utHelpers->rrmdir($this->targetRoot);
     @mkdir($this->targetRoot, '0644', true);
     $this->targetCore = $this->targetRoot . 'core/components/unittest/';
     @mkdir($this->targetCore, '0644', true);
     $this->targetCore = str_replace('\\', '/', $this->targetCore);
     $this->targetLexDir = $this->targetCore . 'lexicon/';
     $this->targetLexDir = str_replace('\\', '/', $this->targetLexDir);
     @mkdir($this->targetLexDir . 'en', '0644', true);
     copy($this->dataDir . 'default.inc.php', $this->targetLexDir . 'en/default.inc.php');
     copy($this->dataDir . 'chunks.inc.php', $this->targetLexDir . 'en/chunks.inc.php');
     copy($this->dataDir . 'properties.inc.php', $this->targetLexDir . 'en/properties.inc.php');
     $this->targetModelDir = $this->targetCore . 'model/';
     $this->targetModelDir = str_replace('\\', '/', $this->targetModelDir);
     @mkdir($this->targetModelDir, '0644', true);
     copy($this->dataDir . 'example.class.php', $this->targetModelDir . 'example.class.php');
     $this->targetDataDir = $this->targetRoot . '_build/data/';
     $this->targetDataDir = str_replace('\\', '/', $this->targetDataDir);
     @mkdir($this->targetDataDir, '0644', true);
     copy($this->dataDir . 'transport.menus.php', $this->targetDataDir . 'transport.menus.php');
     copy($this->dataDir . 'transport.settings.php', $this->targetDataDir . 'transport.settings.php');
     $this->targetJsDir = $this->targetRoot . 'assets/components/unittest/js/';
     $this->targetJsDir = str_replace('\\', '/', $this->targetJsDir);
     @mkdir($this->targetJsDir, '0644', true);
     copy($this->dataDir . 'example.js', $this->targetJsDir . 'example.js');
     $this->targetChunkDir = $this->targetCore . 'elements/chunks/';
     $this->targetChunkDir = str_replace('\\', '/', $this->targetChunkDir);
     @mkdir($this->targetChunkDir, '0644', true);
     copy($this->dataDir . 'chunk1.chunk.html', $this->targetChunkDir . 'chunk1.chunk.html');
     $this->targetPropertiesDir = $this->targetRoot . '_build/data/properties/';
     $this->targetPropertiesDir = str_replace('\\', '/', $this->targetPropertiesDir);
     @mkdir($this->targetPropertiesDir, '0644', true);
     copy($this->dataDir . 'properties.propertyset1.propertyset.php', $this->targetPropertiesDir . 'properties.propertyset1.propertyset.php');
     copy($this->dataDir . 'properties.snippet1.snippet.php', $this->targetPropertiesDir . 'properties.snippet1.snippet.php');
     $this->languages = array('en' => array('default', 'properties', 'forms'));
     $this->assertNotEmpty($this->targetRoot, 'Empty Root');
     $this->assertNotEmpty($this->targetCore, 'Empty target core');
     $this->assertNotEmpty($this->targetLexDir, 'Empty target lex dir');
     $this->assertNotEmpty($this->targetModelDir, 'Empty Model dir');
     $this->assertNotEmpty($this->targetJsDir, 'Empty JS dir');
     $this->assertNotEmpty($this->targetChunkDir, 'Empty chunk dir');
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:72,代码来源:LexiconCodeFileTest.php

示例14: prepare_modx_upgrade

/**
 * Logout all users, clear the cache, make sure config file is writable
 *
 */
function prepare_modx_upgrade($data)
{
    $core_path = $data['core_path'];
    chmod($core_path . 'config/config.inc.php', DIR_PERMS);
    // This might brick if the install isn't working.
    require_once $data['base_path'] . 'index.php';
    $modx = new modX();
    $modx->initialize('mgr');
    // See http://tracker.modx.com/issues/9916
    $sessionTable = $modx->getTableName('modSession');
    $modx->query("TRUNCATE TABLE {$sessionTable}");
    @$modx->cacheManager->refresh();
}
开发者ID:Vitaliz,项目名称:modx_utils,代码行数:17,代码来源:installmodx.php

示例15: array

$resource_id = !empty($_GET['page_id']) && is_numeric($_GET['page_id']) ? $_GET['page_id'] : 1;
$output = array('prod_list' => '', 'pages' => '', 'total' => 0, 'pageCount' => 1, 'onPageLimit' => 1);
require_once '../../../config.core.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
//get resourse context_key
$context_key = 'web';
$query = $modx->newQuery('modResource', array('id' => $resource_id, 'published' => true, 'deleted' => false));
$query->select($modx->getSelectColumns('modResource', '', '', array('context_key')));
$stmt = $query->prepare();
if ($stmt) {
    if ($value = $modx->getValue($stmt)) {
        $context_key = $value;
    }
}
$modx->initialize($context_key);
//get resource
$criteria = $modx->newQuery('modResource');
$criteria->select(array($modx->escape('modResource') . '.*'));
$criteria->where(array('id' => $resource_id, 'deleted' => false, 'published' => true));
$modx->resource = $modx->getObject('modResource', $criteria);
if (!is_object($modx->resource) || !$modx->resource->checkPolicy('view')) {
    echo json_encode($output);
    exit;
}
$modx->resourceIdentifier = $modx->resource->get('id');
$modx->getService('error', 'error.modError');
$modx->getRequest();
$modx->getParser();
$modx->resourceMethod = 'id';
$modx->resource->_contextKey = $modx->context->get('key');
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:31,代码来源:ajax_resources.php


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