- Daftar
- 4 Oct 1988
- Post
- ×
- Like diterima
- 9.136
Templat Modifikasi
Templat: PAGE_CONTAINER
Modifikasi Kunci: your_namespace_copyright_footer_display
Deskripsi:
Pencarian Footer Hak Cipta jenis: PHP Callback
Cari:
Ganti:
Perintah eksekusi: 10
app_setup
Eksekusi panggilan balik: \ Namespace \ Listener :: appSetup Perintah
eksekusi: 10
Keterangan: Pengaturan aplikasi
/src/your/Namespace/Listener.php
(Ganti awalan dengan awalan vendor (mis. Dbtech adalah milik kita, biasanya itu adalah bagian "your" dari penggantian "Your \ Namespace".)
/Src/Your/Namespace/Template/Callback/Copyright.php
NB :
(Ganti prefix dengan awalan vendor (mis. Dbtech : penggantian "Your \ Namespace". ganti www.yoursite.comtautan dengan tautan ke situs web sendiri -ganti "nama perusahaan" trus buat halaman details.php yang menerima ID produk sebagai parameter untuk menampilkan daftar produk yang dijalankan situs, atau hapus seluruh bagian tanda kurung secara bersamaan.)
Templat: PAGE_CONTAINER
Modifikasi Kunci: your_namespace_copyright_footer_display
Deskripsi:
Pencarian Footer Hak Cipta jenis: PHP Callback
Cari:
#({{ phrase\('extra_copyright'\) }})#si
Ganti:
Your\Namespace\Template\Callback\Copyright::insert
Perintah eksekusi: 10
app_setup
Eksekusi panggilan balik: \ Namespace \ Listener :: appSetup Perintah
eksekusi: 10
Keterangan: Pengaturan aplikasi
/src/your/Namespace/Listener.php
PHP:
<?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;
}
}
}
(Ganti awalan dengan awalan vendor (mis. Dbtech adalah milik kita, biasanya itu adalah bagian "your" dari penggantian "Your \ Namespace".)
/Src/Your/Namespace/Template/Callback/Copyright.php
PHP:
<?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™
©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;
}
}
NB :
(Ganti prefix dengan awalan vendor (mis. Dbtech : penggantian "Your \ Namespace". ganti www.yoursite.comtautan dengan tautan ke situs web sendiri -ganti "nama perusahaan" trus buat halaman details.php yang menerima ID produk sebagai parameter untuk menampilkan daftar produk yang dijalankan situs, atau hapus seluruh bagian tanda kurung secara bersamaan.)
Terakhir diubah: