Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Config handler has to treat the xml 'name' as a key but use the wp-pa…
…ckage param value
  • Loading branch information
purplecabbage committed Jan 16, 2014
1 parent 6b3c6e2 commit 3fba012e9fabde814f3229f3844162ad21f73227
Showing 1 changed file with 18 additions and 5 deletions.
@@ -15,13 +15,15 @@ class ConfigHandler
{
public class PluginConfig
{
public PluginConfig(string name, bool autoLoad = false)
public PluginConfig(string name, bool autoLoad = false, string className = "")
{
Name = name;
isAutoLoad = autoLoad;
ClassName = className;
}
public string Name;
public bool isAutoLoad;
public string ClassName;
}

protected Dictionary<string, PluginConfig> AllowedPlugins;
@@ -151,6 +153,16 @@ public bool URLIsAllowed(string url)
return false;
}

public string GetNamespaceForCommand(string key)
{
if(AllowedPlugins.Keys.Contains(key))
{
return AllowedPlugins[key].Name;
}

return "";
}

public bool IsPluginAllowed(string key)
{
return AllowAllPlugins || AllowedPlugins.Keys.Contains(key);
@@ -176,19 +188,20 @@ private void LoadPluginFeatures(XDocument document)

foreach (var feature in features)
{
var name = feature.Attribute("name");
string name = (string)feature.Attribute("name");
var values = from results in feature.Descendants()
where results.Name.LocalName == "param" && ((string)results.Attribute("name") == "wp-package")
select results;

var value = values.FirstOrDefault();
if(value != null)
if (value != null)
{
string key = (string)value.Attribute("value");
Debug.WriteLine("Adding feature.value=" + key);
var onload = value.Attribute("onload");
PluginConfig pConfig = new PluginConfig(key,onload != null && onload.Value == "true");
AllowedPlugins[key] = pConfig;

PluginConfig pConfig = new PluginConfig(key, onload != null && onload.Value == "true");
AllowedPlugins[name] = pConfig;
}
}
}

0 comments on commit 3fba012

Please sign in to comment.