Xf2 Modifikasyon - Copyright Footer Management | Xenforo Türkçe Destek, XenForo Eklenti ve Tema Topluluğu

Xf2 Modifikasyon Copyright Footer Management

XFdestek

Kurucu Üye
XFD Üyesi
Katılım
25 May 2014
Mesajlar
832
Tepkime puanı
356
Puanları
63
Konum
Türkiye
Bu, 5 ayrı satıra sahip 5 modun bulunduğu bir durumdan kaçınarak, tüm telif hakkı altbilgilerini ürünlerinizden tek bir satıra otomatik olarak nasıl birleştireceğinize yönelik hızlı ve kirli bir eğiticidir. : D

Şablon Değişiklikleri

Şablon : PAGE_CONTAINER
Modification Key : your_namespace_copyright_footer_display
Açıklama : Copyright Footer
Search tip : PHP Geri Arama
Bul : #({{ phrase\('extra_copyright'\) }})#si
Değiştir : Your\Namespace\Template\Callback\Copyright::insert
Yürütme sırası : 10


Kod Olay Dinleyicileri Olayı

dinleyin : app_setup
Geri çağırma Yürüt : \ Namespace \ Listener :: appSetup
Uygulama sırası : 10
Açıklama : Uygulama kurulumu


PHP

/src/Your/Namespace/Listener.php

CSS:
<?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;
        }
    }
}
( prefix Satıcı önekiyle değiştirin (örn. Dbtech bizimdir, normalde "Your \ Namespace" yerine "sizin" parçanızdır .)

/Src/Your/Namespace/Template/Callback/Copyright.php

CSS:
<?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 DBTech mod would have done it
            return $matches[1];
        }

        // Create this long string
        $html = '<div>
            Parts of this site powered by XenForo add-ons from YourCompany&#8482;
            &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;
    }
}
( prefix Satıcı önekiyle değiştirin (örn. Dbtech bizimdir, normalde "Your \ Namespace" yerine "sizin" parçanızdır . Ayrıca
Lütfen içeriği görebilmek için Giriş yap veya üye ol.
web sitenize de ekleyin. Son olarak, sitenin çalıştığı ürünlerin listesini görüntülemek için ürün kimliklerini parametre olarak kabul eden details.php sayfasını oluşturun veya tüm parantez bölümünü tamamen kaldırın.)
 
Lütfen Javascript'i etkinleştirin!Javascript'i etkinleştirin!