Updated EditMacro.js to support inserting different syntax depending on rendering engine. Just need to get it to insert the params for MVC now.
Added HttpRequestExtenions with a method GetItemAsString which obsoletes/supercedes the old 'umbraco.helper.Request' method.
This commit is contained in:
39
src/Umbraco.Web/HttpRequestExtensions.cs
Normal file
39
src/Umbraco.Web/HttpRequestExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for the HttpRequest and HttpRequestBase objects
|
||||
/// </summary>
|
||||
public static class HttpRequestExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Safely get a request item as string, if the item does not exist, an empty string is returned.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetItemAsString(this HttpRequest request, string key)
|
||||
{
|
||||
return new HttpRequestWrapper(request).GetItemAsString(key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Safely get a request item as string, if the item does not exist, an empty string is returned.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetItemAsString(this HttpRequestBase request, string key)
|
||||
{
|
||||
var val = HttpContext.Current.Request[key];
|
||||
return !val.IsNullOrWhiteSpace() ? val : string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user