本文整理汇总了PHP中modX::getVersionData方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::getVersionData方法的具体用法?PHP modX::getVersionData怎么用?PHP modX::getVersionData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::getVersionData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDependencies
/**
* Check dependency constraints for the package.
*
* @param array $dependencies An array of dependencies to check.
*
* @return array An array of unsatisfied dependencies.
*/
public function checkDependencies(array $dependencies)
{
$unsatisfied = array();
$dependencies = xPDOTransport::checkPlatformDependencies($dependencies);
foreach ($dependencies as $package => $constraint) {
if (strtolower($package) === strtolower($this->identifier)) {
continue;
}
switch (strtolower($package)) {
case 'modx':
$versionData = $this->xpdo->getVersionData();
if (!xPDOTransport::satisfies($versionData['full_version'], $constraint)) {
$unsatisfied[$package] = $constraint;
}
break;
default:
/* get latest installed package version */
$latestQuery = $this->xpdo->newQuery('modTransportPackage', array(array("UCASE({$this->xpdo->escape('package_name')}) LIKE UCASE({$this->xpdo->quote($package)})"), 'installed:IS NOT' => null));
$latestQuery->sortby('installed', 'DESC');
/** @var modTransportPackage $latest */
$latest = $this->xpdo->getObject('modTransportPackage', $latestQuery);
if ($latest) {
$latest->parseSignature();
if (xPDOTransport::satisfies($latest->version, $constraint)) {
unset($latest);
continue;
}
}
$unsatisfied[$package] = $constraint;
break;
}
}
return $unsatisfied;
}
示例2: args
protected function args(array $args = array())
{
if (!is_array($this->xpdo->version)) {
$this->xpdo->getVersionData();
}
$baseArgs = array('api_key' => $this->get('api_key'), 'username' => $this->get('username'), 'uuid' => $this->xpdo->uuid, 'database' => $this->xpdo->config['dbtype'], 'revolution_version' => $this->xpdo->version['code_name'] . '-' . $this->xpdo->version['full_version'], 'supports' => $this->xpdo->version['code_name'] . '-' . $this->xpdo->version['full_version'], 'http_host' => $this->xpdo->getOption('http_host'), 'php_version' => XPDO_PHP_VERSION, 'language' => $this->xpdo->getOption('manager_language'));
return array_merge($baseArgs, $args);
}
示例3: hasAdminPermission
/**
* Indicates if the logged in user has admin permissions.
* @return bool
*/
public function hasAdminPermission()
{
if (!$this->modx->user || $this->modx->user->get('id') < 1) {
return false;
}
$usergroups = $this->modx->getOption('clientconfig.admin_groups', null, 'Administrator');
$usergroups = explode(',', $usergroups);
$isMember = $this->modx->user->isMember($usergroups, false);
/* If we're not a member of the usergroup(s), check for sudo */
if (!$isMember) {
$v = $this->modx->getVersionData();
if (version_compare($v['full_version'], '2.2.1-pl') == 1) {
$isMember = (bool) $this->modx->user->get('sudo');
}
}
return $isMember;
}
示例4: includeScriptAssets
/**
* Render supporting javascript to try and help it work with MIGX etc
*/
public function includeScriptAssets()
{
$vers = $this->modx->getVersionData();
if ($vers['major_version'] >= 3) {
$this->modx->regClientCSS($this->options['assetsUrl'] . 'mgr/css/imageplus.css');
} else {
$this->modx->regClientCSS($this->options['assetsUrl'] . 'mgr/css/imageplus-22.css');
}
$this->modx->regClientCSS($this->options['assetsUrl'] . 'mgr/css/jquery/jquery.jcrop.min.css');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/imageplus.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/imageplus.panel.input.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/imageplus.window.editor.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/imageplus.migx_renderer.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/tools/JSON2.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/jquery/jquery.min.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/jquery/jquery.jcrop.min.js');
$this->modx->regClientStartupScript($this->options['assetsUrl'] . 'mgr/js/imageplus.jquery.imagecrop.js');
$this->modx->regClientStartupHTMLBlock('<script type="text/javascript">' . ' ImagePlus.config = ' . json_encode($this->options) . ';' . ' var $jIP = jQuery.noConflict();' . '</script>');
}
示例5: dirname
}
}
include dirname(dirname(__FILE__)) . '/config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
set_time_limit(0);
}
$options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $startTime) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
$modx = new modX('', $options);
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modx->startTime = $startTime;
$modx->getVersionData();
$modxVersion = $modx->version['full_version'];
if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
$modx->initialize('mgr', $options);
} else {
$modx->initialize('mgr');
}
if (!$modx->hasPermission('Vapor')) {
die('Access denied');
}
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modxDatabase = $modx->getOption('dbname', $options, $modx->getOption('database', $options));
示例6: systemVersion
/**
* Compares MODX version
*
* @param string $version
* @param string $dir
*
* @return bool
*/
public function systemVersion($version = '2.3.0', $dir = '>=')
{
$this->modx->getVersionData();
return !empty($this->modx->version) && version_compare($this->modx->version['full_version'], $version, $dir);
}
示例7: handleRequest
/**
* The primary MODX request handler (a.k.a. controller).
*
* @return boolean True if a request is handled without interruption.
*/
public function handleRequest()
{
$this->loadErrorHandler();
// If enabled, send the X-Powered-By header to identify this site as running MODX, per discussion in #12882
if ($this->modx->getOption('send_poweredby_header', null, true)) {
$version = $this->modx->getVersionData();
header("X-Powered-By: MODX {$version['code_name']}");
}
$this->sanitizeRequest();
$this->modx->invokeEvent('OnHandleRequest');
if (!$this->modx->checkSiteStatus()) {
header('HTTP/1.1 503 Service Unavailable');
if (!$this->modx->getOption('site_unavailable_page', null, 1)) {
$this->modx->resource = $this->modx->newObject('modDocument');
$this->modx->resource->template = 0;
$this->modx->resource->content = $this->modx->getOption('site_unavailable_message');
} else {
$this->modx->resourceMethod = "id";
$this->modx->resourceIdentifier = $this->modx->getOption('site_unavailable_page', null, 1);
}
} else {
$this->checkPublishStatus();
$this->modx->resourceMethod = $this->getResourceMethod();
$this->modx->resourceIdentifier = $this->getResourceIdentifier($this->modx->resourceMethod);
if ($this->modx->resourceMethod == 'id' && $this->modx->getOption('friendly_urls', null, false) && $this->modx->getOption('request_method_strict', null, false)) {
$uri = $this->modx->context->getResourceURI($this->modx->resourceIdentifier);
if (!empty($uri)) {
if ((int) $this->modx->resourceIdentifier === (int) $this->modx->getOption('site_start', null, 1)) {
$url = $this->modx->getOption('site_url', null, MODX_SITE_URL);
} else {
$url = $this->modx->getOption('site_url', null, MODX_SITE_URL) . $uri;
}
$this->modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
}
}
}
if (empty($this->modx->resourceMethod)) {
$this->modx->resourceMethod = "id";
}
if ($this->modx->resourceMethod == "alias") {
$this->modx->resourceIdentifier = $this->_cleanResourceIdentifier($this->modx->resourceIdentifier);
}
if ($this->modx->resourceMethod == "alias") {
$found = $this->modx->findResource($this->modx->resourceIdentifier);
if ($found) {
$this->modx->resourceIdentifier = $found;
$this->modx->resourceMethod = 'id';
} else {
$this->modx->sendErrorPage();
}
}
$this->modx->beforeRequest();
$this->modx->invokeEvent("OnWebPageInit");
if (!is_object($this->modx->resource)) {
if (!($this->modx->resource = $this->getResource($this->modx->resourceMethod, $this->modx->resourceIdentifier))) {
$this->modx->sendErrorPage();
return true;
}
}
return $this->prepareResponse();
}
示例8: process
public function process()
{
//$startTime = microtime(true);
try {
$vaporOptions = array('excludeExtraTablePrefix' => array(), 'excludeExtraTables' => array(), 'excludeFiles' => array(MODX_BASE_PATH . 'vapor', MODX_BASE_PATH . 'phpmyadmin', MODX_BASE_PATH . 'assets', MODX_BASE_PATH . 'core'));
if (is_readable(VAPOR_DIR . 'config.php')) {
$vaporConfigOptions = @(include VAPOR_DIR . 'config.php');
if (is_array($vaporConfigOptions)) {
$vaporOptions = array_merge($vaporOptions, $vaporConfigOptions);
}
}
if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
set_time_limit(0);
}
$options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $this->getProperty('startTime')) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
$modx = new modX('', $options);
$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modx->startTime = $this->getProperty('startTime');
$modx->getVersionData();
$modxVersion = $modx->version['full_version'];
if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
$modx->initialize('mgr', $options);
} else {
$modx->initialize('mgr');
}
/*$modx->setLogTarget($options['log_target']);
$modx->setLogLevel($options['log_level']);*/
$modx->setOption(xPDO::OPT_CACHE_DB, false);
$modx->setOption(xPDO::OPT_SETUP, true);
$modx->setDebug(-1);
$modxDatabase = $modx->getOption('dbname', $options, $modx->getOption('database', $options));
$modxTablePrefix = $modx->getOption('table_prefix', $options, '');
$core_path = realpath($modx->getOption('core_path', $options, MODX_CORE_PATH)) . '/';
$assets_path = realpath($modx->getOption('assets_path', $options, MODX_ASSETS_PATH)) . '/';
$manager_path = realpath($modx->getOption('manager_path', $options, MODX_MANAGER_PATH)) . '/';
$base_path = realpath($modx->getOption('base_path', $options, MODX_BASE_PATH)) . '/';
$modx->log(modX::LOG_LEVEL_INFO, "core_path=" . $core_path);
$modx->log(modX::LOG_LEVEL_INFO, "assets_path=" . $assets_path);
$modx->log(modX::LOG_LEVEL_INFO, "manager_path=" . $manager_path);
$modx->log(modX::LOG_LEVEL_INFO, "base_path=" . $base_path);
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
/** @var modWorkspace $workspace */
$workspace = $modx->getObject('modWorkspace', 1);
if (!$workspace) {
$modx->log(modX::LOG_LEVEL_FATAL, "no workspace!");
}
$package = $builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
/* Defines the classes to extract (also used for truncation) */
$classes = $this->getClassesList();
$attributes = array('vehicle_class' => 'xPDOFileVehicle');
/* get all files from the components directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_CORE_PATH . 'components');
$package->put(
array(
'source' => MODX_CORE_PATH . 'components',
'target' => 'return MODX_CORE_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* get all files from the assets directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_BASE_PATH . 'assets');
$package->put(
array(
'source' => MODX_BASE_PATH . 'assets',
'target' => 'return MODX_BASE_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* get all files from the manager/components directory */
/*$modx->log(modX::LOG_LEVEL_INFO, "Packaging " . MODX_MANAGER_PATH . 'components');
$package->put(
array(
'source' => MODX_MANAGER_PATH . 'components',
'target' => 'return MODX_MANAGER_PATH;'
),
array(
'vehicle_class' => 'xPDOFileVehicle'
)
);*/
/* find other files/directories in the MODX_BASE_PATH */
$excludes = array('_build', 'setup', 'assets', 'ht.access', 'index.php', 'config.core.php', dirname(MODX_CORE_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_CORE_PATH) : 'core', dirname(MODX_CONNECTORS_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_CONNECTORS_PATH) : 'connectors', dirname(MODX_MANAGER_PATH) . '/' === MODX_BASE_PATH ? basename(MODX_MANAGER_PATH) : 'manager');
if (isset($vaporOptions['excludeFiles']) && is_array($vaporOptions['excludeFiles'])) {
$excludes = array_unique($excludes + $vaporOptions['excludeFiles']);
}
/*if ($dh = opendir(MODX_BASE_PATH)) {
$includes = array();
while (($file = readdir($dh)) !== false) {
/* ignore files/dirs starting with . or matching an exclude */
/*if (strpos($file, '.') === 0 || in_array(strtolower($file), $excludes)) {
continue;
}
//.........这里部分代码省略.........