Sets the priority of the plugin
public setPriority ( mixed $priority ) : boolean | ||
$priority | mixed | The priority to set. One of +1, -1, first, last, or a number. If given a number, this will displace all plugins at that number and set their priorities +1 |
return | boolean |
/** * Import plugin settings * * @param string $info * @param string $settings_mode Options to load plugin settings. One of overwrite, if_not_exists, or ignore * @return type bool */ function transfer_plugins_import($info, $settings_mode = 'if_not_exists') { $info = unserialize($info); if (!$info) { return false; } $version = elgg_extract('transfer_plugins_format', $info); if ($version != TRANSFER_PLUGINS_FORMAT) { return false; } // @todo check elgg, plugin, and transfer_plugin version compatibility. if (!isset($info['plugins'])) { return false; } $r = true; foreach ($info['plugins'] as $plugin_info) { $plugin_id = $plugin_info['id']; $plugin = new ElggPlugin($plugin_id); // not installed if (!$plugin->isValid()) { continue; } $r &= $plugin->setPriority($plugin_info['priority']); if ($plugin_info['active'] && !$plugin->isActive()) { $r &= $plugin->activate(); } if ($settings_mode != 'ignore' && $plugin_info['settings']) { foreach ($plugin_info['settings'] as $name => $value) { switch ($settings_mode) { case 'overwrite': $plugin->setSetting($name, $value); break; case 'if_not_exists': // @todo not sure if this works because isset isn't overloaded in ElggPlugin if (!isset($plugin->{$name})) { $plugin->setSetting($name, $value); } break; } } } } return $r; }