public function loadMODX()
    {
        if (static::$modx) {
            return static::$modx;
        }

        if (isset(static::$config['MODX_CONFIG_PATH']) && file_exists(static::$config['MODX_CONFIG_PATH']) ) {
            require_once static::$config['MODX_CONFIG_PATH'];

        } elseif (defined('MODX_CONFIG_PATH') && file_exists(MODX_CONFIG_PATH)) {
            require_once(MODX_CONFIG_PATH);

        } else {
            $this->findMODX();
            if (defined('MODX_CONFIG_PATH') && file_exists(MODX_CONFIG_PATH) && !defined('MODX_CORE_PATH')) {
                require_once(MODX_CONFIG_PATH);
            }

            if (!defined('MODX_CORE_PATH')) {
                throw new \RuntimeException('There does not seem to be a MODX installation here. ');
            }

        }

        require_once(MODX_CORE_PATH . 'model/modx/modx.class.php');

        /** @var \modX $modx */
        $modx = new \modX();
        $modx->initialize('mgr');
        $modx->getService('error', 'error.modError', '', '');
        $modx->setLogTarget('ECHO');

        static::$modx = $modx;

        return $modx;
    }
public function loadMODX()
    {
        if (static::$modx) {
            return static::$modx;
        }

        if (isset(static::$config['MODX_CONFIG_PATH']) && file_exists(static::$config['MODX_CONFIG_PATH']) ) {
            require_once static::$config['MODX_CONFIG_PATH'];

        } elseif (defined('MODX_CONFIG_PATH') && file_exists(MODX_CONFIG_PATH)) {
            require_once(MODX_CONFIG_PATH);

        } else {
            $this->findMODX();
            if (defined('MODX_CONFIG_PATH') && file_exists(MODX_CONFIG_PATH) && !defined('MODX_CORE_PATH')) {
                require_once(MODX_CONFIG_PATH);
            }

            if (!defined('MODX_CORE_PATH')) {
                throw new \RuntimeException('There does not seem to be a MODX installation here. ');
            }

        }

        require_once(MODX_CORE_PATH . 'model/modx/modx.class.php');

        /** @var \modX $modx */
        $modx = new \modX();
        $modx->initialize('mgr');
        $modx->getService('error', 'error.modError', '', '');
        $modx->setLogTarget('ECHO');

        static::$modx = $modx;

        return $modx;
    }
public function loadMODX ( ) { if ( static :: $ modx ) { return static :: $ modx ; } if ( isset ( static :: $ config [ 'MODX_CONFIG_PATH' ] ) && file_exists ( static :: $ config [ 'MODX_CONFIG_PATH' ] ) ) { require_once static :: $ config [ 'MODX_CONFIG_PATH' ] ; } elseif ( defined ( 'MODX_CONFIG_PATH' ) && file_exists ( MODX_CONFIG_PATH ) ) { require_once ( MODX_CONFIG_PATH ) ; } else { $ this -> findMODX ( ) ; if ( defined ( 'MODX_CONFIG_PATH' ) && file_exists ( MODX_CONFIG_PATH ) && ! defined ( 'MODX_CORE_PATH' ) ) { require_once ( MODX_CONFIG_PATH ) ; } if ( ! defined ( 'MODX_CORE_PATH' ) ) { throw new \ RuntimeException ( 'There does not seem to be a MODX installation here. ' ) ; } } require_once ( MODX_CORE_PATH . 'model/modx/modx.class.php' ) ; /** @var \modX $modx */ $ modx = new \ modX ( ) ; $ modx -> initialize ( 'mgr' ) ; $ modx -> getService ( 'error' , 'error.modError' , '' , '' ) ; $ modx -> setLogTarget ( 'ECHO' ) ; static :: $ modx = $ modx ; return $ modx ; }
Loads a new modX instance

@throws \RuntimeException
@return \modX
Loads a new modX instance