/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <param name="providers">The providers to be displayed.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers) { string retVal = string.Empty; if (page != null) { retVal = ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers); } return(retVal); }
/// <summary>Gets the OneAll social sharing display script.</summary> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <param name="providers">The providers to be displayed.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers) { if (providers == null || providers.Length < 1 || providers.All(x => string.IsNullOrEmpty(x.Identifier))) { throw new ArgumentException(OneAllConstants.ERR_INVALID_PARAM_COLLECTION, OneAllConstants.PARAM_PROVIDERS); } string retVal = null; string styleInternal = string.Empty; string dataUrl = string.Empty, dataOpt = string.Empty; StringBuilder builder = new StringBuilder(); switch (style) { case OneAllButtonStyle.Small: { styleInternal = "oas_box_btns_s"; } break; case OneAllButtonStyle.Medium: { styleInternal = "oas_box_btns_m"; } break; case OneAllButtonStyle.Large: { styleInternal = "oas_box_btns_l"; } break; case OneAllButtonStyle.HorizontalCounter: { styleInternal = "oas_box_count_h"; } break; case OneAllButtonStyle.VerticalCounter: { styleInternal = "oas_box_count_v"; } break; default: { styleInternal = "oas_box_btns_s"; } break; } dataUrl = (shareUrl != null ? " data-url=\"" + shareUrl.ToString() + "\"" : string.Empty); dataOpt = (!socialInsights ? " data-opt=\"si:0\"" : string.Empty); builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "<div class=\"oas_box {0}\"{1}{2}>", styleInternal, dataUrl, dataOpt)); foreach (Provider provider in providers) { if (string.IsNullOrEmpty(provider.Identifier)) { continue; } else { builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "\t<span class=\"oas_btn oas_btn_{0}\" title=\"{1}\"></span>", provider.Identifier, (!string.IsNullOrEmpty(titleFormat) && titleFormat.Contains("{0}") && !string.IsNullOrEmpty(provider.Name) ? string.Format(CultureInfo.InvariantCulture, titleFormat, provider.Name) : string.Empty))); } } builder.Append("</div>"); if (builder != null) { retVal = builder.ToString(); } return(retVal); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <param name="providers">The providers to be displayed.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers) { string retVal = string.Empty; if (page != null) { retVal = ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers); } return retVal; }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl) { return OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, shareUrl, Settings.Instance.Providers.ToArray()); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat) { return OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, Settings.Instance.ShareUrl); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style) { return OneAllSharingDisplayScript(page, style, Settings.Instance.EnableInsights ?? true); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl) { return(OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, shareUrl, Settings.Instance.Providers.ToArray())); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style, bool socialInsights, string titleFormat) { return(OneAllSharingDisplayScript(page, style, socialInsights, titleFormat, Settings.Instance.ShareUrl)); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="page">The <see cref="Page" /> being executed.</param> /// <param name="style">The desired button style.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static string OneAllSharingDisplayScript(this Page page, OneAllButtonStyle style) { return(OneAllSharingDisplayScript(page, style, Settings.Instance.EnableInsights ?? true)); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <param name="providers">The providers to be displayed.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers) { MvcHtmlString retVal = null; if (helper != null) { retVal = MvcHtmlString.Create(ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers)); } return(retVal); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat) { return(OneAllSharingDisplayScript(helper, style, socialInsights, titleFormat, Settings.Instance.ShareUrl)); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style) { return(OneAllSharingDisplayScript(helper, style, Settings.Instance.EnableInsights ?? true)); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <param name="shareUrl">A custom URL to share, or null to share the URL of the page executing this script.</param> /// <param name="providers">The providers to be displayed.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat, Uri shareUrl, params Provider[] providers) { MvcHtmlString retVal = null; if (helper != null) { retVal = MvcHtmlString.Create(ExtensionImplementations.OneAllSharingDisplayScript(style, socialInsights, titleFormat, shareUrl, providers)); } return retVal; }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <param name="socialInsights">True to enable social insights and measure referral traffic.</param> /// <param name="titleFormat">The format for the button title, example: "Send to {0}" where "{0}" will be the provider name.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style, bool socialInsights, string titleFormat) { return OneAllSharingDisplayScript(helper, style, socialInsights, titleFormat, Settings.Instance.ShareUrl); }
/// <summary>Gets the OneAll sharing display script for the currently initialized OneAll domain.</summary> /// <param name="helper">The standard MVC HTML helper.</param> /// <param name="style">The desired button style.</param> /// <returns>A string of HTML to cause the sharing API to be rendered.</returns> public static MvcHtmlString OneAllSharingDisplayScript(this HtmlHelper helper, OneAllButtonStyle style) { return OneAllSharingDisplayScript(helper, style, Settings.Instance.EnableInsights ?? true); }