Skip to content

Instantly share code, notes, and snippets.

@opengeek
Created August 11, 2015 03:09
Show Gist options
  • Save opengeek/9437278d49dcd287de08 to your computer and use it in GitHub Desktop.
Save opengeek/9437278d49dcd287de08 to your computer and use it in GitHub Desktop.
An example of using the `setMODX()` method I'm proposing for Teleport
<?php
require __DIR__ . '/config.core.php';
require MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
require __DIR__ . '/src/bootstrap.php';
define('TELEPORT_BASE_PATH', rtrim(getcwd(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
try {
$teleport = Teleport\Teleport::instance([
'profile_name' => 'site',
'profile_code' => 'site'
]);
$profileStream = $teleport->setMODX($modx);
$request = $teleport->getRequest('Teleport\Request\Request');
$request->handle([
'action' => 'Extract',
'profile' => $profileStream,
'tpl' => 'tpl/settings.tpl.json'
]);
echo implode(PHP_EOL, $request->getResults()) . PHP_EOL;
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment