Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows optionally removing rel from privacy and terms #5054

Merged
merged 8 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 69 additions & 67 deletions DNN Platform/Website/admin/Skins/Privacy.ascx.cs
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.UI.Skins.Controls
{
using System;
namespace DotNetNuke.UI.Skins.Controls
{
using System;

using DotNetNuke.Abstractions;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Abstractions;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using Microsoft.Extensions.DependencyInjection;

/// -----------------------------------------------------------------------------
/// <summary></summary>
/// <returns></returns>
/// <remarks></remarks>
/// -----------------------------------------------------------------------------
public partial class Privacy : SkinObjectBase
{
private const string MyFileName = "Privacy.ascx";
private readonly INavigationManager _navigationManager;

public Privacy()
{
this._navigationManager = Globals.DependencyProvider.GetRequiredService<INavigationManager>();
}

public string Text { get; set; }

public string CssClass { get; set; }

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

this.InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
if (!string.IsNullOrEmpty(this.CssClass))
{
this.hypPrivacy.CssClass = this.CssClass;
}

if (!string.IsNullOrEmpty(this.Text))
{
this.hypPrivacy.Text = this.Text;
}
else
{
this.hypPrivacy.Text = Localization.GetString("Privacy", Localization.GetResourceFile(this, MyFileName));
}

this.hypPrivacy.NavigateUrl = this.PortalSettings.PrivacyTabId == Null.NullInteger ? this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Privacy") : this._navigationManager.NavigateURL(this.PortalSettings.PrivacyTabId);
this.hypPrivacy.Attributes["rel"] = "nofollow";
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

private void InitializeComponent()
{
}
}
}
/// -----------------------------------------------------------------------------
/// <summary></summary>
/// <returns></returns>
/// <remarks></remarks>
/// -----------------------------------------------------------------------------
public partial class Privacy : SkinObjectBase
{
private const string MyFileName = "Privacy.ascx";
private readonly INavigationManager _navigationManager;

public Privacy()
{
this._navigationManager = Globals.DependencyProvider.GetRequiredService<INavigationManager>();
}

public string Text { get; set; }

public string CssClass { get; set; }

public string Rel { get; set; } = "nofollow"

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

this.InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
if (!string.IsNullOrEmpty(this.CssClass))
{
this.hypPrivacy.CssClass = this.CssClass;
}

if (!string.IsNullOrEmpty(this.Text))
{
this.hypPrivacy.Text = this.Text;
}
else
{
this.hypPrivacy.Text = Localization.GetString("Privacy", Localization.GetResourceFile(this, MyFileName));
}

this.hypPrivacy.NavigateUrl = this.PortalSettings.PrivacyTabId == Null.NullInteger ? this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Privacy") : this._navigationManager.NavigateURL(this.PortalSettings.PrivacyTabId);
this.hypPrivacy.Attributes["rel"] = this.Rel;
}
bdukes marked this conversation as resolved.
Show resolved Hide resolved
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

private void InitializeComponent()
{
}
}
}
137 changes: 69 additions & 68 deletions DNN Platform/Website/admin/Skins/Terms.ascx.cs
Original file line number Diff line number Diff line change
@@ -1,74 +1,75 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.UI.Skins.Controls
{
using System;
namespace DotNetNuke.UI.Skins.Controls
{
using System;

using DotNetNuke.Abstractions;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Abstractions;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using Microsoft.Extensions.DependencyInjection;

/// -----------------------------------------------------------------------------
/// <summary></summary>
/// <returns></returns>
/// <remarks></remarks>
/// -----------------------------------------------------------------------------
public partial class Terms : SkinObjectBase
{
private const string MyFileName = "Terms.ascx";
private readonly INavigationManager _navigationManager;

public Terms()
{
this._navigationManager = Globals.DependencyProvider.GetRequiredService<INavigationManager>();
}

public string Text { get; set; }

public string CssClass { get; set; }

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

this.InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
if (!string.IsNullOrEmpty(this.CssClass))
{
this.hypTerms.CssClass = this.CssClass;
}

if (!string.IsNullOrEmpty(this.Text))
{
this.hypTerms.Text = this.Text;
}
else
{
this.hypTerms.Text = Localization.GetString("Terms", Localization.GetResourceFile(this, MyFileName));
}

this.hypTerms.NavigateUrl = this.PortalSettings.TermsTabId == Null.NullInteger ? this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Terms") : this._navigationManager.NavigateURL(this.PortalSettings.TermsTabId);

this.hypTerms.Attributes["rel"] = "nofollow";
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

private void InitializeComponent()
{
}
}
}
/// -----------------------------------------------------------------------------
/// <summary></summary>
/// <returns></returns>
/// <remarks></remarks>
/// -----------------------------------------------------------------------------
public partial class Terms : SkinObjectBase
{
private const string MyFileName = "Terms.ascx";
private readonly INavigationManager _navigationManager;

public Terms()
{
this._navigationManager = Globals.DependencyProvider.GetRequiredService<INavigationManager>();
}

public string Text { get; set; }

public string CssClass { get; set; }

public string Rel { get; set; } = "nofollow"

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

this.InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
if (!string.IsNullOrEmpty(this.CssClass))
{
this.hypTerms.CssClass = this.CssClass;
}

if (!string.IsNullOrEmpty(this.Text))
{
this.hypTerms.Text = this.Text;
}
else
{
this.hypTerms.Text = Localization.GetString("Terms", Localization.GetResourceFile(this, MyFileName));
}

this.hypTerms.NavigateUrl = this.PortalSettings.TermsTabId == Null.NullInteger ? this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Terms") : this._navigationManager.NavigateURL(this.PortalSettings.TermsTabId);
this.hypPrivacy.Attributes["rel"] = this.Rel;
bdukes marked this conversation as resolved.
Show resolved Hide resolved
}
bdukes marked this conversation as resolved.
Show resolved Hide resolved
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

private void InitializeComponent()
{
}
}
}