Exemplo n.º 1
0
/**
 * Use this script to add your extension package to MODX's "radar".
 * This should only need to be done once.
 * Note that we have to instantiate MODX: xPDO is not sufficient
 * because we're running functions that exist only in MODX, not in the 
 * underlying xPDO framework.
 *
 * USAGE:
 * 1. Copy this file into the docroot (web root) of your MODX installation.
 * 2. Execute the file by visiting it in a browser, e.g. http://yoursite.com/add_extension.php
 */
//------------------------------------------------------------------------------
//! CONFIGURATION
//------------------------------------------------------------------------------
// Your package shortname:
$package_name = '';
//------------------------------------------------------------------------------
//  DO NOT TOUCH BELOW THIS LINE
//------------------------------------------------------------------------------
define('MODX_API_MODE', true);
require_once 'index.php';
if (!defined('MODX_CORE_PATH')) {
    print '<p>MODX_CORE_PATH not defined! Did you put this script in the web root of your MODX installation?</p>';
    exit;
}
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->addExtensionPackage($package_name, "[[++core_path]]components/{$package_name}/model/");
print 'Success!';
Exemplo n.º 2
0
if (!file_exists(dirname(dirname(__FILE__)) . '/config.core.php')) {
    die('ERROR: missing ' . dirname(dirname(__FILE__)) . '/config.core.php file defining the MODX core path.');
}
echo "<pre>";
/* Boot up MODX */
echo "Loading modX...\n";
require_once dirname(dirname(__FILE__)) . '/config.core.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
echo "Initializing manager...\n";
$modx->initialize('mgr');
$modx->getService('error', 'error.modError', '', '');
$componentPath = dirname(dirname(__FILE__));
$FlickrSource = $modx->getService('flickrsource', 'FlickrSource', $componentPath . '/core/components/flickrsource/model/flickrsource/', array('flickrsource.core_path' => $componentPath . '/core/components/flickrsource/'));
/* Extension Package */
$modx->addExtensionPackage('flickrsource', $componentPath . '/core/components/flickrsource/model/');
/* Namespace */
if (!createObject('modNamespace', array('name' => 'flickrsource', 'path' => $componentPath . '/core/components/flickrsource/', 'assets_path' => $componentPath . '/assets/components/flickrsource/'), 'name', false)) {
    echo "Error creating namespace flickrsource.\n";
}
/* Path settings */
if (!createObject('modSystemSetting', array('key' => 'flickrsource.core_path', 'value' => $componentPath . '/core/components/flickrsource/', 'xtype' => 'textfield', 'namespace' => 'flickrsource', 'area' => 'Paths', 'editedon' => time()), 'key', false)) {
    echo "Error creating flickrsource.core_path setting.\n";
}
if (!createObject('modSystemSetting', array('key' => 'flickrsource.assets_path', 'value' => $componentPath . '/assets/components/flickrsource/', 'xtype' => 'textfield', 'namespace' => 'flickrsource', 'area' => 'Paths', 'editedon' => time()), 'key', false)) {
    echo "Error creating flickrsource.assets_path setting.\n";
}
/* Fetch assets url */
$url = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $url .= 's';