Example #1
0
 public static function register()
 {
     /**
      * Register ModSync namespace
      */
     $autoLoader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
     $autoLoader->registerNamespace('ModSync', Base::getCoreComponentsDir() . DIRECTORY_SEPARATOR . __NAMESPACE__);
     $autoLoader->register();
     /**
      * Register all other namespaces
      */
     $components = new DirectoryIterator(Base::getCoreComponentsDir());
     foreach ($components as $component) {
         if ($component->isDot()) {
             continue;
         }
         if ($component->getFilename() == 'ModSync') {
             continue;
         }
         $componentFile = new SplFileInfo($component->getPathname() . DIRECTORY_SEPARATOR . 'Component' . DIRECTORY_SEPARATOR . 'Component.php');
         if ($componentFile->isFile()) {
             $autoLoader->registerNamespace($component->getFilename(), $component->getPathname());
         }
     }
 }
Example #2
0
<?php

if (!defined('MODX_API_MODE')) {
    define('MODX_API_MODE', false);
}
require_once '../../../web/config/auto_prepend.php';
@(include \ModSync\Base::getCoreDir() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.core.php');
if (!defined('MODX_CORE_PATH')) {
    define('MODX_CORE_PATH', \ModSync\Base::getCoreDir() . DIRECTORY_SEPARATOR);
}
/* include the modX class */
if (!@(include_once MODX_CORE_PATH . 'model/modx/modx.class.php')) {
    $errorMessage = 'Site temporarily unavailable';
    @(include MODX_CORE_PATH . 'error/unavailable.include.php');
    header('HTTP/1.1 503 Service Unavailable');
    echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
    exit;
}
/* start output buffering */
ob_start();
/* Create an instance of the modX class */
$modx = new modX();
if (!is_object($modx) || !$modx instanceof modX) {
    @ob_end_flush();
    $errorMessage = '<a href="setup/">MODX not installed. Install now?</a>';
    @(include MODX_CORE_PATH . 'error/unavailable.include.php');
    header('HTTP/1.1 503 Service Unavailable');
    echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
    exit;
}
/* Initialize the default 'web' context */