From 4b2684e36e226315c5bd4b93f49ab2a5fc121303 Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 6 Dec 2010 15:23:01 +0000 Subject: Renamed 'elgg' manifest requirment to 'elgg_version' to be more in line with the current options. Removed assignments in if statements. 1.7 manifest files properly show elgg_version as a requirement. git-svn-id: http://code.elgg.org/elgg/trunk@7550 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginManifest.php | 40 +++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'engine/classes/ElggPluginManifest.php') diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index ccd0d984a..01dcd1046 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -234,7 +234,9 @@ class ElggPluginManifest { * @return string */ public function getBlurb() { - if (!$blurb = elgg_echo($this->parser->getAttribute('blurb'))) { + $blurb = elgg_echo($this->parser->getAttribute('blurb')); + + if (!$blurb) { $blurb = elgg_get_excerpt($this->getDescription()); } @@ -293,7 +295,9 @@ class ElggPluginManifest { * @return array */ public function getCategories() { - if (!$cats = $this->parser->getAttribute('category')) { + $cats = $this->parser->getAttribute('category'); + + if (!$cats) { $cats = array(); } @@ -306,7 +310,9 @@ class ElggPluginManifest { * @return array */ public function getScreenshots() { - if (!$ss = $this->parser->getAttribute('screenshot')) { + $ss = $this->parser->getAttribute('screenshot'); + + if (!$ss) { $ss = array(); } @@ -324,7 +330,9 @@ class ElggPluginManifest { * @return array */ public function getProvides() { - if (!$provides = $this->parser->getAttribute('provides')) { + $provides = $this->parser->getAttribute('provides'); + + if (!$provides) { $provides = array(); } @@ -351,7 +359,23 @@ class ElggPluginManifest { * @return array */ public function getRequires() { - if (!$reqs = $this->parser->getAttribute('requires')) { + // rewrite the 1.7 style elgg_version as a real requires. + if ($this->apiVersion < 1.8) { + $elgg_version = $this->parser->getAttribute('elgg_version'); + if ($elgg_version) { + $reqs = array( + array( + 'type' => 'elgg_version', + 'version' => $elgg_version, + 'comparison' => 'ge' + ) + ); + } + } else { + $reqs = $this->parser->getAttribute('requires'); + } + + if (!$reqs) { $reqs = array(); } @@ -359,7 +383,7 @@ class ElggPluginManifest { foreach ($reqs as $req) { switch ($req['type']) { - case 'elgg': + case 'elgg_version': case 'elgg_release': $struct = $this->_depsRequiresStructElgg; break; @@ -441,7 +465,9 @@ class ElggPluginManifest { * @return array */ public function getConflicts() { - if (!$conflicts = $this->parser->getAttribute('conflicts')) { + $conflicts = $this->parser->getAttribute('conflicts'); + + if (!$conflicts) { $conflicts = array(); } -- cgit v1.2.3