XF 2 Tip Copyright Footer

Adedayo

Member
Registered
Joined
Jun 21, 2019
Messages
16
Points
3

Reputation:

Template Modifications

Template: PAGE_CONTAINER
Modification Key: your_namespace_copyright_footer_display
Description: Copyright Footer
Search type: PHP Callback


Find:
Code:
#({{ phrase\('extra_copyright'\) }})#si
Replace:
Code:
Your\Namespace\Template\Callback\Copyright::insert
Execution order: 10

Code Event Listeners

Listen to event: app_setup
Execute callback: Your\Namespace\Listener :: appSetup
Execution order: 10
Description: App setup


PHP

/src/Your/Namespace/Listener.php
PHP:
Code:
<?php

namespace Your\Namespace;

class Listener
{
/**
* The product ID (in the store)
* @var integer
*/
protected static $_productId = 0;

/**
* @param \XF\App $app
*/
public static function appSetup(
\XF\App $app
)
{
if (!$app->offsetExists('prefix_branding_free'))
{
// Make sure we fetch the branding array from the application
$branding = $app->offsetExists('prefix_branding') ? $app->prefix_branding : [];

// Add productid to the array
$branding[] = self::$_productId;

// Store the branding
$app->prefix_branding = $branding;
}
}
}
(Replace

[CODE]
prefix
with the vendor prefix (e.g. dbtech is ours, normally it's the "your" part of the "Your\Namespace" replacement.)

/src/Your/Namespace/Template/Callback/Copyright.php
PHP:
Code:
<?php

namespace Your\Namespace\Template\Callback;

class Copyright
{
/**
* @param $matches
*
* @return string
*/
public static function insert($matches)
{
if (!isset($matches[1]))
{
// Clean error prevention
return '';
}

/** @var \XF\App $app */
$app = \XF::app();

$branding = $app->offsetExists('prefix_branding') ? $app->prefix_branding : [];

if (!count($branding) OR !is_array($branding))
{
// We had nothing left, another mod would have inserted the copyright footer
return $matches[1];
}

// Create this long string
$html = '<div>
Parts of this site powered by XenForo add-ons from YourCompany™
&copy;2011-' . date('Y') . ' <a class="u-concealed" rel="nofollow" href="https://www.yoursite.com" target="_blank">YourCompany</a>
(<a class="u-concealed" rel="nofollow" href="https://www.yoursite.com/details.php?products=' . implode(',', $branding) . '" target="_blank">Details</a>)
</div>';

// Make sure we null this out
$app->prefix_branding = [];

return $matches[1] . $html;
}
}
(Replace

[CODE]
prefix
with the vendor prefix (e.g. dbtech is ours, normally it's the "your" part of the "Your\Namespace" replacement. Also, replace the
Code:
www.yoursite.com
 

vefari

Member
Registered
Joined
Oct 15, 2019
Messages
21
Points
13

Reputation:

is this the official way they tell you to do it when you purchase debranding?
 

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
19,149
Points
823

Reputation:

View previous replies…

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
19,149
Points
823

Reputation:

what are the steps for that
vefarisrc/XF.php
Find
Code:
public static function getCopyrightHtml()
    {
        return '<a href="https://xenforo.com" class="u-concealed" dir="ltr" target="_blank">Forum software by XenForo<sup>&reg;</sup> <span class="copyright">&copy; 2010-2019 XenForo Ltd.</span></a>';
    }
replace
Code:
public static function getCopyrightHtml()
    {
        return 'Forum software by XenForo<sup>&reg;</sup> <span class="copyright">&copy; 2010-2019 XenForo Ltd.</span>';
    }
 

vefari

Member
Registered
Joined
Oct 15, 2019
Messages
21
Points
13

Reputation:

src/XF.php
Find
Code:
public static function getCopyrightHtml()
    {
        return '<a href="https://xenforo.com" class="u-concealed" dir="ltr" target="_blank">Forum software by XenForo<sup>&reg;</sup> <span class="copyright">&copy; 2010-2019 XenForo Ltd.</span></a>';
    }
replace
Code:
public static function getCopyrightHtml()
    {
        return 'Forum software by XenForo<sup>&reg;</sup> <span class="copyright">&copy; 2010-2019 XenForo Ltd.</span>';
    }
ENXF NETyeah but then then the hash for that php file doesnt match up.
when you buy xenforo with branding removed, they give you instructions for it. what are those instructions?
 

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
19,149
Points
823

Reputation:

yeah but then then the hash for that php file doesnt match up.
when you buy xenforo with branding removed, they give you instructions for it. what are those instructions?
vefariI removed it myself, I did not buy remove the copyright
 
Top