本文整理汇总了PHP中rex_addon::setProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_addon::setProperty方法的具体用法?PHP rex_addon::setProperty怎么用?PHP rex_addon::setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_addon
的用法示例。
在下文中一共展示了rex_addon::setProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProperty
/**
* @override
* @see redaxo/include/classes/rex_addon#setProperty($addon, $property, $value)
*/
static function setProperty($addon, $plugin, $property, $value = null)
{
return parent::setProperty(array($addon, $plugin), $property, $value);
}
示例2: checkRequirements
private function checkRequirements($config)
{
$temppath = rex_path::addon('.new.' . $this->addonkey);
// ---- update "version", "requires" and "conflicts" properties
$versions = new SplObjectStorage();
$requirements = new SplObjectStorage();
$conflicts = new SplObjectStorage();
if (isset($config['requires'])) {
$requirements[$this->addon] = $this->addon->getProperty('requires');
$this->addon->setProperty('requires', $config['requires']);
}
if (isset($config['conflicts'])) {
$conflicts[$this->addon] = $this->addon->getProperty('conflicts');
$this->addon->setProperty('conflicts', $config['conflicts']);
}
$versions[$this->addon] = $this->addon->getVersion();
$this->addon->setProperty('version', isset($config['version']) ? $config['version'] : $this->file['version']);
$availablePlugins = $this->addon->getAvailablePlugins();
foreach ($availablePlugins as $plugin) {
if (is_dir($temppath . '/plugins/' . $plugin->getName())) {
$config = rex_file::getConfig($temppath . '/plugins/' . $plugin->getName() . '/' . rex_package::FILE_PACKAGE);
if (isset($config['requires'])) {
$requirements[$plugin] = $plugin->getProperty('requires');
$plugin->setProperty('requires', $config['requires']);
}
if (isset($config['conflicts'])) {
$conflicts[$plugin] = $plugin->getProperty('conflicts');
$plugin->setProperty('conflicts', $config['conflicts']);
}
if (isset($config['version'])) {
$versions[$plugin] = $plugin->getProperty('version');
$plugin->setProperty('requires', $config['version']);
}
}
}
// ---- check requirements
$messages = [];
$manager = rex_addon_manager::factory($this->addon);
if (!$manager->checkRequirements()) {
$messages[] = $manager->getMessage();
}
if (!$manager->checkConflicts()) {
$messages[] = $manager->getMessage();
}
if (empty($messages)) {
foreach ($availablePlugins as $plugin) {
$manager = rex_plugin_manager::factory($plugin);
if (!$manager->checkRequirements()) {
$messages[] = $plugin->getPackageId() . ': ' . $manager->getMessage();
}
if (!$manager->checkConflicts()) {
$messages[] = $plugin->getPackageId() . ': ' . $manager->getMessage();
}
}
foreach (rex_package::getAvailablePackages() as $package) {
if ($package->getAddon() === $this->addon) {
continue;
}
$manager = rex_package_manager::factory($package);
if (!$manager->checkPackageRequirement($this->addon->getPackageId())) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
} elseif (!$manager->checkPackageConflict($this->addon->getPackageId())) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
} else {
foreach ($versions as $reqPlugin) {
if (!$manager->checkPackageRequirement($reqPlugin->getPackageId())) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
}
if (!$manager->checkPackageConflict($reqPlugin->getPackageId())) {
$messages[] = $package->getPackageId() . ': ' . $manager->getMessage();
}
}
}
}
}
// ---- reset "version", "requires" and "conflicts" properties
foreach ($versions as $package) {
$package->setProperty('version', $versions[$package]);
}
foreach ($requirements as $package) {
$package->setProperty('requires', $requirements[$package]);
}
foreach ($conflicts as $package) {
$package->setProperty('conflicts', $conflicts[$package]);
}
return empty($messages) ? true : implode('<br />', $messages);
}