本文整理匯總了C#中PHP.Core.ScriptContext.DefineConstant方法的典型用法代碼示例。如果您正苦於以下問題:C# ScriptContext.DefineConstant方法的具體用法?C# ScriptContext.DefineConstant怎麽用?C# ScriptContext.DefineConstant使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP.Core.ScriptContext
的用法示例。
在下文中一共展示了ScriptContext.DefineConstant方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}