本文整理匯總了C#中PHP.Core.ScriptContext.Include方法的典型用法代碼示例。如果您正苦於以下問題:C# ScriptContext.Include方法的具體用法?C# ScriptContext.Include怎麽用?C# ScriptContext.Include使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP.Core.ScriptContext
的用法示例。
在下文中一共展示了ScriptContext.Include方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Setup
protected void Setup(ScriptContext c)
{
// Set a variable to the My Documents path.
var section = (ClientSettingsSection)ConfigurationManager
.GetSection("applicationSettings/wordpress.net.Properties.Settings");
var settings = section.Settings;
foreach (SettingElement setting in settings)
{
var value = setting.Value.ValueXml.InnerText;
if (!string.IsNullOrWhiteSpace(value))
{
c.DefineConstant(setting.Name, setting.Value.ValueXml.InnerText);
}
else
{
switch (setting.Name)
{
case "ABSPATH":
var path = System.IO.Directory.GetParent(Server.MapPath("~")).Parent.FullName +
"\\components\\WordPress\\";
c.DefineConstant("ABSPATH", path.Replace("\\", "/"));
break;
}
}
}
/** Sets up WordPress vars and included files. */
c.Include("..\\components\\WordPress\\wp-settings.php", true);
}
示例2: Load
public override void Load(string code = "")
{
try
{
context = ScriptContext.CurrentContext;
context.Include(rpath + "\\" + Name + ".php", true);
Class = (PhpObject) context.NewObject(Name);
PHPGlobals = context.GlobalVariables;
context.GlobalVariables.Add("Commands", chatCommands);
context.GlobalVariables.Add("DataStore", DataStore.GetInstance());
context.GlobalVariables.Add("Find", Find.GetInstance());
context.GlobalVariables.Add("GlobalData", GlobalData);
context.GlobalVariables.Add("Plugin", this);
context.GlobalVariables.Add("Server", Pluton.Server.GetInstance());
context.GlobalVariables.Add("ServerConsoleCommands", consoleCommands);
context.GlobalVariables.Add("Util", Util.GetInstance());
context.GlobalVariables.Add("Web", Web.GetInstance());
context.GlobalVariables.Add("World", World.GetInstance());
foreach (var x in PHPGlobals)
{
Globals.Add(x.Key.ToString());
}
State = PluginState.Loaded;
}
catch (Exception ex)
{
Logger.LogException(ex);
State = PluginState.FailedToLoad;
}
PluginLoader.GetInstance().OnPluginLoaded(this);
}