41 $reader = @new \Eloquent\Composer\Configuration\ConfigurationReader;
42 $this->configuration = $reader->read($this->plugin->getPath() .
'composer.json');
45 $this->plugin->getID(),
67 if ($this->configuration->projectName() !== $this->plugin->getID()) {
78 $license = $this->configuration->license();
79 if (!empty($license)) {
80 $license =
implode(
', ', $license);
83 return (
string) $license;
92 $cats = $this->configuration->keywords() ?: [];
95 foreach ($cats as $cat) {
104 $vendor = strtolower((
string) $this->configuration->vendorName());
105 if (!isset(
$result[$vendor])) {
118 $conflicts = $this->configuration->conflict();
122 list(,$projectname) = explode(
'/',
$name);
123 if (!empty($projectname)) {
139 if (empty($conflicts)) {
143 if (isset($conflicts[
'elgg'])) {
148 unset($conflicts[
'elgg']);
151 foreach ($conflicts as
$plugin_id => $constraints) {
159 throw new ConflictException(
"Plugin [{$plugin->getID()}] with version: {$plugin->getVersion()} conflicts with constraint {$constraints}");
172 foreach ($active_plugins as
$plugin) {
173 $conflicts = $plugin->getConflicts();
174 if (!isset($conflicts[$this->plugin->getID()])) {
178 $constraint = $conflicts[$this->plugin->getID()];
180 $msg =
'The plugin ' . $this->plugin->getDisplayName() .
' with version ' . $this->plugin->getVersion();
181 $msg .=
' conflicts with constraint '. $constraint .
' defined in ' . $plugin->getID();
196 return Semver::satisfies(
$version, $constraints);
206 $requirements = $this->configuration->dependencies();
207 if (!isset($requirements[
'php'])) {
211 $php_version = phpversion();
213 throw new PhpVersionException(
"The PHP version ({$php_version}) does not meet the plugin [{$this->plugin->getID()}] requirements of {$requirements['php']}");
224 $requirements = $this->configuration->dependencies();
225 foreach ($requirements as
$name => $constraint) {
226 if (!str_starts_with(
$name,
'ext-')) {
232 throw new PhpExtensionException(
"Plugin [{$this->plugin->getID()}] requires the PHP extensions {$extension}");
237 throw new PhpExtensionException(
"The PHP extension version ({$extension_version}) does not meet the plugin [{$this->plugin->getID()}] requirements of {$constraint}");
253 $cat_raw_string = strtolower(
"admin:plugins:category:{$category}");
254 if (
_elgg_services()->translator->languageKeyExists($cat_raw_string)) {
258 return ucwords(
str_replace([
'-',
'_'],
' ', $category));
elgg_get_release()
Get the current Elgg release.
elgg_get_plugins(string $status= 'active')
Returns an ordered list of plugins.
assertConflicts()
Asserts if there are conflicts.
if(!$user||!$user->canDelete()) $name
elgg_get_plugin_from_id(string $plugin_id)
Elgg plugins library Contains functions for managing plugins.
Indicates plugin php extension requirement issues.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
getConfiguration()
Returns the composer configuration.
getFriendlyCategory($category)
Returns a category's friendly name.
$plugin_id
Remove all user and plugin settings from the give plugin ID.
Indicates invalid php version for a plugin.
elgg_is_active_plugin(string $plugin_id)
Returns if a plugin is active for a current site.
__construct(\ElggPlugin $plugin)
Constructor.
assertActivePluginConflicts()
Asserts if there are active plugins that conflict with the current plugin.
Holds plugin composer.json related functions.
getCategories()
Returns an array with categories.
assertPluginId()
Asserts if plugin id matches project name.
checkConstraints($version, $constraints)
Determine if given version satisfies given constraints.
_elgg_services()
Get the global service provider.
assertRequiredPhpExtensions()
Asserts if the required php extensions matches the actual installed extensions.
assertRequiredPhpVersion()
Asserts if the required php version matches the actual php version.
Indicates a mismatch between the plugin ID in the composer.json and the plugin directory.
Indicates a conflict with the plugin.
Indicates something wrong with the plugin composer.json.
getConflicts()
Returns an array of projectnames with their conflicting version.
getLicense()
Returns the license.