本文整理汇总了PHP中modPackageBuilder::registerNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP modPackageBuilder::registerNamespace方法的具体用法?PHP modPackageBuilder::registerNamespace怎么用?PHP modPackageBuilder::registerNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modPackageBuilder
的用法示例。
在下文中一共展示了modPackageBuilder::registerNamespace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'lexicon' => $root . 'core/components/' . PKG_NAMESPACE . '/lexicon/', 'documents' => $root . 'core/components/' . PKG_NAMESPACE . '/documents/', 'elements' => $root . 'core/components/' . PKG_NAMESPACE . '/elements/', 'source_manager_assets' => $root . 'manager/assets/components/' . PKG_NAMESPACE, 'source_core' => $root . 'core/components/' . PKG_NAMESPACE, 'source_connectors' => $root . 'connectors/components/' . PKG_NAMESPACE);
unset($root);
/* load modx */
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
echo XPDO_CLI_MODE ? '' : '<pre>';
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAMESPACE, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAMESPACE, false, true, '{core_path}components/' . PKG_NAMESPACE . '/');
/* create the plugin object */
$plugin = $modx->newObject('modPlugin');
$plugin->set('id', 1);
$plugin->set('name', PKG_NAME);
$plugin->set('description', 'Speeds up manager panel by using ajax page loading.');
$plugin->set('plugincode', file_get_contents($sources['source_core'] . '/elements/plugins/' . PKG_NAMESPACE . '.plugin.php'));
$plugin->set('category', 0);
/* add plugin events */
$events = (include $sources['data'] . PKG_NAMESPACE . '.plugin.events.php');
if (is_array($events) && !empty($events)) {
$plugin->addMany($events);
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find plugin events!');
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugin Events.');
示例2: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/');
unset($root);
/* instantiate MODx */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* load builder */
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('quickcrumbs', false, true, '{core_path}components/quickcrumbs/');
/* create snippet object */
$modx->log(xPDO::LOG_LEVEL_INFO, 'Adding in snippet.');
flush();
$snippet = $modx->newObject('modSnippet');
$snippet->set('name', 'QuickCrumbs');
$snippet->set('description', '<strong>' . PKG_VERSION . '-' . PKG_RELEASE . '</strong> A quick and efficient bread crumbs snippet for MODx Revolution');
$snippet->set('category', 0);
$snippet->set('snippet', file_get_contents($sources['source_core'] . '/quickcrumbs.snippet.php'));
$properties = (include $sources['build'] . 'properties.inc.php');
if (!empty($properties)) {
$snippet->setProperties($properties);
}
unset($properties);
/* create a transport vehicle for the data object */
$vehicle = $builder->createVehicle($snippet, array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name'));
示例3: strtolower
return $modx->error->failure();
}
/* get version, release, files */
$version = $_POST['version'];
$release = $_POST['release'];
/* format package name */
$name_lower = strtolower($_POST['category']);
$name_lower = str_replace(array(' ', '-', '.', '*', '!', '@', '#', '$', '%', '^', '&', '_'), '', $name_lower);
/* define file paths and string replacements */
$directories = array();
$cachePath = $modx->getOption('core_path') . 'cache/';
$pathLookups = array('sources' => array('{base_path}', '{core_path}', '{assets_path}'), 'targets' => array($modx->getOption('base_path', null, MODX_BASE_PATH), $modx->getOption('core_path', null, MODX_CORE_PATH), $modx->getOption('assets_path', null, MODX_ASSETS_PATH)));
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage($name_lower, $version, $release);
$builder->registerNamespace($name_lower, false, true, '{core_path}components/' . $name_lower . '/');
/* create category */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', $_POST['category']);
/* add Chunks */
$chunkList = $modx->fromJSON($_POST['chunks']);
if (!empty($chunkList)) {
$chunks = array();
foreach ($chunkList as $chunkData) {
if (empty($chunkData['id'])) {
continue;
}
$chunk = $modx->getObject('modChunk', $chunkData['id']);
if (empty($chunk)) {
continue;
示例4: modPackageBuilder
* @package modx
* @subpackage processors.workspace.builder
*/
$modx->lexicon->load('workspace', 'package_builder');
if (!$modx->hasPermission('package_builder')) {
return $modx->error->failure($modx->lexicon('permission_denied'));
}
$_PACKAGE =& $_SESSION['modx.pb'];
/* load the modPackageBuilder class and get an instance */
$modx->log(MODX_LOG_LEVEL_INFO, 'Loading package builder.');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
/* create a new package */
$modx->log(MODX_LOG_LEVEL_INFO, 'Creating a new package: ' . $_PACKAGE['name'] . '-' . $_PACKAGE['version'] . '-' . $_PACKAGE['release']);
$builder->createPackage($_PACKAGE['name'], $_PACKAGE['version'], $_PACKAGE['release']);
$builder->registerNamespace($_PACKAGE['namespace'], $_PACKAGE['autoselects']);
/* define some locations for file resources */
$sources = array('root' => dirname(dirname(__FILE__)) . '/', 'assets' => dirname(dirname(__FILE__)) . '/assets/');
/* set up some default attributes that define install behavior */
$attributes = array(xPDOTransport::UNIQUE_KEY => 'name', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RESOLVE_FILES => true, xPDOTransport::RESOLVE_PHP => true);
$modx->log(modX::LOG_LEVEL_INFO, 'Loading vehicles into package.');
foreach ($_PACKAGE['vehicles'] as $vehicle) {
$c = $modx->getObject($vehicle['class_key'], $vehicle['object']);
if ($c == null) {
continue;
}
if (!isset($vehicle['attributes'])) {
$vehicle['attributes'] = array();
}
$attr = array_merge($attributes, $vehicle['attributes']);
$v = $builder->createVehicle($c, $attr);
示例5: dirname
require_once dirname(dirname(dirname(__FILE__))) . '/core/config/config.inc.php';
define('MODX_CONFIG_KEY','config');
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx= new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->loadClass('transport.modPackageBuilder','',false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage('visioncart', '0.6.1', 'rc4');
$builder->registerNamespace('visioncart', false, true, '{core_path}components/visioncart/');
// Add system settings
require_once(dirname(__FILE__).'/builder.systemsettings.php');
// Add system settings
require_once(dirname(__FILE__).'/builder.plugins.php');
// Add categories+snippets+chunks and create file vehicle
require_once(dirname(__FILE__).'/builder.categories.php');
// Add files to the category vehicle and put the category vehicle into the builder
require_once(dirname(__FILE__).'/builder.files.php');
// Add modMenu and modAction
require_once(dirname(__FILE__).'/builder.menu.php');
示例6: array
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'chunks' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/chunks/', 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/', 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'pages' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/pages/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->getService('error', 'error.modError');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, PKG_NAMESPACE_PATH);
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
/* load system settings */
if (defined('BUILD_SETTING_UPDATE')) {
$settings = (include $sources['data'] . 'transport.settings.php');
if (!is_array($settings)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
} else {
$attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => BUILD_SETTING_UPDATE);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
}
unset($settings, $setting, $attributes);
示例7: modX
/* instantiate MODx */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* set package info */
define('PKG_NAME', 'Personalize');
define('PKG_VERSION', '3.7.0');
define('PKG_RELEASE', 'pl');
/* load builder */
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('personalize', false, true, '{core_path}components/personalize/');
/* create snippet objects */
/* create category */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', 'personalize');
/* add snippets */
$modx->log(modX::LOG_LEVEL_INFO, 'Adding in snippets.');
$snippets = (include $sources['data'] . 'transport.snippets.php');
if (is_array($snippets)) {
$category->addMany($snippets);
} else {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding snippets failed.');
}
/* add chunks */
/*$modx->log(modX::LOG_LEVEL_INFO,'Adding in chunks.');
示例8: modX
unset($root);
/* instantiate MODx */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
/* load builder */
$modx->log(xPDO::LOG_LEVEL_INFO, 'Creating package builder');
flush();
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/', '{assets_path}components/' . PKG_NAME_LOWER . '/');
$builder->registerNamespace('modldapuser', false, true, '{core_path}components/' . PKG_NAME_LOWER . '/', '{assets_path}components/' . PKG_NAME_LOWER . '/');
/* PLUGINS */
/* ------------------------------------------------------ */
$modx->log(xPDO::LOG_LEVEL_INFO, 'Adding in plugin.');
flush();
$plugin = $modx->newObject('modPlugin');
$plugin->set('name', PKG_NAME);
$plugin->set('description', '<strong>' . PKG_VERSION . '-' . PKG_RELEASE . '</strong> This plugin is part of ModLDAP packages: handling LDAP-User authentication.');
$plugin->set('category', 0);
$plugin->set('plugincode', getSnippetContent($sources['plugins'] . 'plugin.modldap.php'));
//add properties to plugin
$properties = (include $sources['data'] . 'plugin.modldap.properties.php');
$plugin->setProperties($properties);
unset($properties);
//add system events to plugin
示例9: build
/**
* Unified build script: build a MODX transport package from files contained
* inside $pkg_root_dir
*
* @param string $pkg_root_dir path to local package root (w trailing slash)
*
* @throws Exception
*/
public function build($pkg_root_dir)
{
$pkg_root_dir = self::get_dir($pkg_root_dir);
$this->build_prep($pkg_root_dir);
$this->config['is_build'] = true;
// TODO
$this->config['force_static'] = false;
// TODO
$required = array('package_name', 'namespace', 'version', 'release');
foreach ($required as $k) {
if (!$this->get($k)) {
throw new Exception('Missing required configuration parameter: ' . $k);
}
}
$this->modx->log(modX::LOG_LEVEL_INFO, 'Beginning build of package "' . $this->get('package_name') . '"');
$this->modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($this->modx);
$sanitized_package_name = $this->get('package_name');
$builder->createPackage($sanitized_package_name, $this->get('version'), $this->get('release'));
$builder->registerNamespace($this->get('namespace'), false, true, '{core_path}components/' . $this->get('namespace') . '/');
// Tests (Validators): this is run BEFORE your package code is in place
// so you cannot reference/include package files from your validator! They won't exist when the code is run.
$validator_file = $this->get_core_path($pkg_root_dir) . rtrim($this->get('validators_dir'), '/') . '/install.php';
if (file_exists($validator_file)) {
$this->modx->log(modX::LOG_LEVEL_INFO, 'Packaging validator ' . $validator_file);
$config = $this->config;
$config['source'] = $validator_file;
$validator_attributes = array('vehicle_class' => 'xPDOScriptVehicle', 'source' => $validator_file, xPDOTransport::ABORT_INSTALL_ON_VEHICLE_FAIL => $this->get('abort_install_on_fail'));
$vehicle = $builder->createVehicle($config, $validator_attributes);
$builder->putVehicle($vehicle);
} else {
$this->modx->log(modX::LOG_LEVEL_DEBUG, 'No validator detected at ' . $validator_file);
}
$Category = $this->modx->newObject('modCategory');
$Category->set('category', $this->get('category'));
// Import Elements
$chunks = self::_get_elements('modChunk', $pkg_root_dir);
$plugins = self::_get_elements('modPlugin', $pkg_root_dir);
$snippets = self::_get_elements('modSnippet', $pkg_root_dir);
$tvs = self::_get_elements('modTemplateVar', $pkg_root_dir);
$templates = self::_get_elements('modTemplate', $pkg_root_dir);
if ($chunks) {
$Category->addMany($chunks);
}
if ($plugins) {
$Category->addMany($plugins);
}
if ($snippets) {
$Category->addMany($snippets);
}
if ($templates) {
$Category->addMany($templates);
}
if ($tvs) {
$Category->addMany($tvs);
}
// TODO: skip this if there are no elements
//if (empty($chunks) && empty($plugins) && empty($snippets) && empty($templates) && empty($tvs)) {
$build_attributes = array();
$build_attributes = $this->get_build_attributes($Category, 'modCategory');
$this->modx->log(modX::LOG_LEVEL_DEBUG, 'build_attributes for ' . $Category->_class . "\n" . print_r($build_attributes, true));
$vehicle = $builder->createVehicle($Category, $build_attributes);
//}
//$builder->putVehicle($vehicle);
// Files...: TODO: these need their own builder
// We package these from the temporary copies inside of repoman's cache.
// Assets
if (file_exists($this->build_assets_path) && is_dir($this->build_assets_path)) {
$this->modx->log(modX::LOG_LEVEL_INFO, 'Packing assets from ' . $this->build_assets_path);
$vehicle->resolve('file', array('source' => rtrim($this->build_assets_path, '/'), 'target' => "return MODX_ASSETS_PATH . 'components/';"));
}
// Core
if (file_exists($this->build_core_path) && is_dir($this->build_core_path)) {
$this->modx->log(modX::LOG_LEVEL_INFO, 'Packing core files from ' . $this->build_core_path);
$vehicle->resolve('file', array('source' => rtrim($this->build_core_path, '/'), 'target' => "return MODX_CORE_PATH . 'components/';"));
}
$builder->putVehicle($vehicle);
// Migrations: we attach our all-purpose resolver to handle migrations
$config = $this->config;
$config['source'] = dirname(__FILE__) . '/resolver.php';
$attributes = array('vehicle_class' => 'xPDOScriptVehicle');
$vehicle = $builder->createVehicle($config, $attributes);
$builder->putVehicle($vehicle);
// Add Version Setting
$repoman_version_build_attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true);
$VersionSetting = $this->modx->newObject('modSystemSetting');
$VersionSetting->set('key', $this->get('namespace') . '.version');
$VersionSetting->set('value', $this->get('version'));
$VersionSetting->set('xtype', 'textfield');
$VersionSetting->set('namespace', $this->get('namespace'));
$VersionSetting->set('area', $this->get('namespace') . ':default');
$vehicle = $builder->createVehicle($VersionSetting, $repoman_version_build_attributes);
//.........这里部分代码省略.........
示例10: registerNamespace
public function registerNamespace($ns = 'core', $autoIncludes = true, $packageNamespace = true, $path = '', $assetsPath = '')
{
$this->builder->registerNamespace($ns, $autoIncludes, $packageNamespace, $path, $assetsPath);
}
示例11: dirname
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'data' => $root . '_build/data/', 'resolvers' => $root . '_build/resolvers/', 'chunks' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/chunks/', 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 'plugins' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/', 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 'pages' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/pages/', 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER);
unset($root);
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->getService('error', 'error.modError');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$modx->addPackage();
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, PKG_NAMESPACE_PATH_CORE, PKG_NAMESPACE_PATH_ASSETS);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
/* load system settings */
if (defined('BUILD_SETTING_UPDATE')) {
$settings = (include $sources['data'] . 'transport.settings.php');
if (!is_array($settings)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
} else {
$attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => BUILD_SETTING_UPDATE);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
示例12: modX
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setDebug(false);
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
echo '<pre>';
$modx->setLogTarget('ECHO');
error_reporting(E_ALL);
ini_set('display_errors', true);
$name = 'janitor';
$version = '1.6';
$release = 'beta';
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage($name, $version, $release);
$builder->registerNamespace('janitor', false, true, '{core_path}components/janitor/');
$base = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $base, 'assets' => $base . 'assets/components/janitor/', 'docs' => $base . 'assets/components/janitor/docs/', 'core' => $base . 'core/components/janitor/', 'lexicon' => $base . 'core/components/janitor/lexicon/', 'model' => $base . 'core/components/janitor/model/', 'templates' => $base . 'core/components/janitor/templates/', 'build' => $base . '_build/', 'data' => $base . '_build/data/', 'resolvers' => $base . '_build/resolvers/', 'source_core' => $base . 'core/components/janitor', 'source_assets' => $base . 'assets/components/janitor');
unset($base);
$vehicles = array();
/* ACTIONS */
$menu = (require_once $sources['data'] . 'actions.data.php');
if (!$menu) {
$modx->log(xPDO::LOG_LEVEL_FATAL, 'Menu not found!');
}
$attr = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'text', xPDOTransport::RELATED_OBJECTS => true, xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array('Action' => array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => array('namespace', 'controller'))));
$vehicle = $builder->createVehicle($menu, $attr);
$vehicles[] = $vehicle;
/* SETTINGS */
require_once $sources['data'] . 'settings.data.php';
$attr = array(xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RELATED_OBJECTS => false, xPDOTransport::UNIQUE_KEY => 'key');
示例13: dirname
unset($root);
/* save memory */
require_once dirname(__FILE__) . '/build.config.php';
// The MODx class:
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* Okay, it's time for the meat. Let's first off use $modx->loadClass to load the modPackageBuilder class. Then we'll instantiate an instance of it, and create a package.
*/
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage('churchevents', '0.3', 'beta2');
//name, version, and release
$builder->registerNamespace('churchevents', false, true, '{core_path}components/churchevents/');
// create system settings:
$settings = array();
$settings['churchevents.allowRequests'] = $modx->newObject('modSystemSetting');
$settings['churchevents.allowRequests']->fromArray(array('key' => 'churchevents.allowRequests', 'value' => false, 'xtype' => 'combo-boolean', 'namespace' => 'churchevents', 'area' => 'ChurchEvents'), '', true, true);
$attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => false);
if (!is_array($settings)) {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding settings failed.');
}
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' system settings.');
flush();
unset($settings, $setting, $attributes);
示例14: modX
unset($root);
/* override with your own defines here (see build.config.sample.php) */
require_once $sources['build'] . 'includes/functions.php';
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
echo '<pre>';
flush();
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->directory = dirname(dirname(__FILE__)) . '/_packages/';
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('sisea', false, true, '{core_path}components/' . PKG_NAME_LOWER . '/', '{assets_path}components/' . PKG_NAME_LOWER . '/');
/* create category */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', PKG_NAME);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in category.');
flush();
/* add snippets */
$snippets = (include $sources['data'] . 'transport.snippets.php');
if (is_array($snippets)) {
$category->addMany($snippets, 'Snippets');
} else {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding snippets failed.');
}
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($snippets) . ' snippets.');
flush();
示例15: dirname
unset($root);
/* override with your own defines here (see build.config.php) */
require_once dirname(__FILE__) . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . 'includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
if (!XPDO_CLI_MODE) {
echo '<pre>';
}
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('analytics', false, true, '{core_path}components/analytics' . '/');
/* create category */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', PKG_NAME);
/* load system settings */
$settings = (include $sources['data'] . 'transport.settings.php');
if (is_array($settings) && !empty($settings)) {
$attributes = array(xPDOTransport::UNIQUE_KEY => 'key', xPDOTransport::PRESERVE_KEYS => true, xPDOTransport::UPDATE_OBJECT => true);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
flush();
} else {