From 896a57156e01406bbf3bb8ee2b4c84a9cad8d10c Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 12 Feb 2011 19:57:39 +0000 Subject: Refs #2898: Using an XML namespace instead of version attribute on plugin manifests. git-svn-id: http://code.elgg.org/elgg/trunk@8170 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginManifest.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'engine/classes/ElggPluginManifest.php') diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index fcd0094c4..e230cd3f2 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -8,8 +8,8 @@ * as $this->parser. * * To add new parser versions, name them ElggPluginManifestParserXX - * where XX is the version specified in the top-level - * tag. + * where XX is the version specified in the top-level + * tag's XML namespace. * * @package Elgg.Core * @subpackage Plugins @@ -22,6 +22,12 @@ class ElggPluginManifest { */ protected $parser; + /** + * The root for plugin manifest namespaces. + * This is in the format http://www.elgg.org/plugin_manifest/ + */ + protected $namespace_root = 'http://www.elgg.org/plugin_manifest/'; + /** * The expected structure of a plugins requires element */ @@ -144,12 +150,15 @@ class ElggPluginManifest { } // set manifest api version - if (isset($manifest_obj->attributes['version'])) { - $this->apiVersion = (float)$manifest_obj->attributes['version']; + if (isset($manifest_obj->attributes['xmlns'])) { + $namespace = $manifest_obj->attributes['xmlns']; + $version = str_replace($this->namespace_root, '', $namespace); } else { - $this->apiVersion = 1.7; + $version = 1.7; } + $this->apiVersion = $version; + $parser_class_name = 'ElggPluginManifestParser' . str_replace('.', '', $this->apiVersion); // @todo currently the autoloader freaks out if a class doesn't exist. -- cgit v1.2.3