Addons Help Copyright

le-melvin

Member
Hello can explain how to make a (Copyright) in php
I'm a beginner I seek my I find anything that's her I made you a apple

(already seen my code can not understand)

PHP:
<?php

/**
* Helper ******* Addon for EventListener.
*
* @package *******_*******Helper
* Version 1.0.1
*/
class Helper_EventListeners
{
    protected static $_copyrightNotice = null;
    protected static $_templateList = array(
        'admin'    => array(
            '_all'    => array()
        ),
        'public'    => array(
            '_all'    => array()
        ),
    );
    public static $setCopyright = null;
  
  
    protected static function _setCopyrightNotice($copyrightNotice = ''){
        self::$_copyrightNotice = (string) '<div id="xc" class="concealed muted" style="float:left;margin-left: 10px;"><style>@media (max-width:480px){.Responsive #xc span{display: none;}}</style><div class="muted"><a href="http://*******.com/" class="concealed" title="******* Limited"><span>XenForo </span>Add-ons by *******<span> &trade;  &copy; 2012-'.date("Y").' ******* LLC.</span></a></div></div>';
    }
  
  
    protected static $_needCopyright = null;
  
    protected static function _checkCopyrightRequire(){
        if(self::$_needCopyright===null){
            self::$_needCopyright = false;
            foreach(self::$*******AddOns AS $brAddon){
                if(empty($brAddon['copyright_removal'])){
                    self::$_needCopyright = true;
                    return self::$_needCopyright;
                }
            }
        }
        return self::$_needCopyright;
    }
  
    public static function _setTemplateCreate()
    {
      
    }
    public static function initTemplateCreate(&$templateName, array &$params, XenForo_Template_Abstract $template)
    {
        if(!empty(self::$_templateList)){
            $templateList = self::$_templateList;
            if($template instanceof XenForo_Template_Admin){
                if(!empty($templateList['admin'][$templateName]) && is_array($templateList['admin'][$templateName])){
                    foreach($templateList['admin'][$templateName] AS $key=>$templateTitle){
                        $template->preloadTemplate($templateTitle);
                    }
                    unset($templateList['admin'][$templateName], $templateTitle);
                }
                if(!empty($templateList['admin']['_all']) && is_array($templateList['admin']['_all'])){
                    foreach($templateList['admin']['_all'] AS $key=>$templateTitle){
                        $template->preloadTemplate($templateTitle);
                    }
                    unset($templateList['admin']['_all'], $templateTitle);
                }
            }else{
                if(!empty($templateList['public'][$templateName]) && is_array($templateList['public'][$templateName])){
                    foreach($templateList['public'][$templateName] AS $key=>$templateTitle){
                        $template->preloadTemplate($templateTitle);
                    }
                    unset($templateList['public'][$templateName], $templateTitle);
                }
                if(!empty($templateList['public']['_all']) && is_array($templateList['public']['_all'])){
                    foreach($templateList['public']['_all'] AS $key=>$templateTitle){
                        $template->preloadTemplate($templateTitle);
                    }
                    unset($templateList['public']['_all'], $templateTitle);
                }
            }
            self::$_templateList = $templateList;
        }
    }
    public static function initTemplateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        if(self::$setCopyright) return;
        switch ($hookName) {
            case 'page_container_breadcrumb_bottom':
                if($contents && strpos($contents,'xc')){
                    self::$setCopyright = true;
                }
                break;
            case 'footer_after_copyright':
                if(self::_checkCopyrightRequire()){
                    if(self::$_copyrightNotice===null){
                        self::_setCopyrightNotice();
                    }
                    if(self::$_copyrightNotice && self::$setCopyright===null){
                        if(!$contents || !strpos($contents,'xc')){
                            $contents = $contents . self::$_copyrightNotice;
                        }
                        self::$setCopyright = true;
                    }
                }
                break;
        }
    }
    // keep this function for security
    public static function _templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
      
    }
  

    public static function getModelFromCache($modelName)
    {
        if (!isset(self::$_modelCache[$modelName]))
        {
            self::$_modelCache[$modelName] = XenForo_Model::create($modelName);
        }

        return self::$_modelCache[$modelName];
    }
  
}
 
I am not sure I understand what you are asking sir. Do you want to add your own copyright in your add on?
 
I have never added a copyright notice to any of my add-ons. If I did, I would just use a template modification applied to the footer template:

find:
Code:
{xen:phrase extra_copyright}

replace:
Code:
<div>My copyrighted notice</div>
$0

You can make it more complicated, but for those who want the copyright notice gone, they are going to have it removed any ways.

Also with a TMS, for branding free, it's just a matter of exporting the XML without the TMS for the footer.
 
Back
Top Bottom