init.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Fred package.
  4. *
  5. * Copyright (c) MODX, LLC
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. $tStart= microtime(true);
  11. define('MODX_API_MODE', true);
  12. $modx_cache_disabled = false;
  13. require_once dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.core.php';
  14. if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/core/');
  15. /* include the modX class */
  16. if (!@include_once (MODX_CORE_PATH . "model/modx/modx.class.php")) {
  17. exit();
  18. }
  19. /* start output buffering */
  20. ob_start();
  21. /* Create an instance of the modX class */
  22. $modx= new modX();
  23. if (!is_object($modx) || !($modx instanceof modX)) {
  24. ob_get_level() && @ob_end_flush();
  25. exit();
  26. }
  27. $modx->startTime= $tStart;
  28. $modx->initialize('web');
  29. $corePath = $modx->getOption('fred.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/fred/');
  30. /** @var Fred $fred */
  31. $fred = $modx->getService(
  32. 'fred',
  33. 'Fred',
  34. $corePath . 'model/fred/',
  35. array(
  36. 'core_path' => $corePath
  37. )
  38. );