Classes/Page/Part/FooterPart.php
public function main($title)
    {
        // INIT
        $ret        = array();
        $tsSetup    = $GLOBALS['TSFE']->tmpl->setup;
        $tsServices = array();

        $beLoggedIn = isset($GLOBALS['BE_USER']->user['username']);

        $disabledHeaderCode = false;
        if (!empty($tsSetup['config.']['disableAllHeaderCode'])) {
            $disabledHeaderCode = true;
        }

        if (!empty($tsSetup['plugin.']['metaseo.']['services.'])) {
            $tsServices = $tsSetup['plugin.']['metaseo.']['services.'];
        }

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterSetup', $this, $tsServices);

        // #########################################
        // GOOGLE ANALYTICS
        // #########################################

        if (!empty($tsServices['googleAnalytics'])) {
            $gaConf = $tsServices['googleAnalytics.'];

            $gaEnabled = true;

            if ($disabledHeaderCode && empty($gaConf['enableIfHeaderIsDisabled'])) {
                $gaEnabled = false;
            }

            if ($gaEnabled && !(empty($gaConf['showIfBeLogin']) && $beLoggedIn)) {
                // Build Google Analytics service
                $ret['ga'] = $this->buildGoogleAnalyticsCode($tsServices, $gaConf);

                if (!empty($gaConf['trackDownloads']) && !empty($gaConf['trackDownloadsScript'])) {
                    $ret['ga.trackdownload'] = $this->serviceGoogleAnalyticsTrackDownloads($gaConf);
                }
            } elseif ($gaEnabled && $beLoggedIn) {
                // Disable caching
                $GLOBALS['TSFE']->set_no_cache('MetaSEO: Google Analytics code disabled, backend login detected');

                // Backend login detected, disable cache because this page is viewed by BE-users
                $ret['ga.disabled'] = '<!-- Google Analytics disabled, '
                    . 'Page cache disabled - Backend-Login detected -->';
            }
        }


        // #########################################
        // PIWIK
        // #########################################
        if (!empty($tsServices['piwik.'])
            && !empty($tsServices['piwik.']['url'])
            && !empty($tsServices['piwik.']['id'])
        ) {
            $piwikConf = $tsServices['piwik.'];

            $piwikEnabled = true;

            if ($disabledHeaderCode && empty($piwikConf['enableIfHeaderIsDisabled'])) {
                $piwikEnabled = false;
            }

            if ($piwikEnabled && !(empty($piwikConf['showIfBeLogin']) && $beLoggedIn)) {
                // Build Piwik service
                $ret['piwik'] = $this->buildPiwikCode($tsServices, $piwikConf);
            } elseif ($piwikEnabled && $beLoggedIn) {
                // Disable caching
                $GLOBALS['TSFE']->set_no_cache('MetaSEO: Piwik code disabled, backend login detected');

                // Backend login detected, disable cache because this page is viewed by BE-users
                $ret['piwik.disabled'] = '<!-- Piwik disabled, Page cache disabled - Backend-Login detected -->';
            }
        }

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterOutput', $this, $ret);

        return implode("\n", $ret);
    }
public function main($title)
    {
        // INIT
        $ret        = array();
        $tsSetup    = $GLOBALS['TSFE']->tmpl->setup;
        $tsServices = array();

        $beLoggedIn = isset($GLOBALS['BE_USER']->user['username']);

        $disabledHeaderCode = false;
        if (!empty($tsSetup['config.']['disableAllHeaderCode'])) {
            $disabledHeaderCode = true;
        }

        if (!empty($tsSetup['plugin.']['metaseo.']['services.'])) {
            $tsServices = $tsSetup['plugin.']['metaseo.']['services.'];
        }

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterSetup', $this, $tsServices);

        // #########################################
        // GOOGLE ANALYTICS
        // #########################################

        if (!empty($tsServices['googleAnalytics'])) {
            $gaConf = $tsServices['googleAnalytics.'];

            $gaEnabled = true;

            if ($disabledHeaderCode && empty($gaConf['enableIfHeaderIsDisabled'])) {
                $gaEnabled = false;
            }

            if ($gaEnabled && !(empty($gaConf['showIfBeLogin']) && $beLoggedIn)) {
                // Build Google Analytics service
                $ret['ga'] = $this->buildGoogleAnalyticsCode($tsServices, $gaConf);

                if (!empty($gaConf['trackDownloads']) && !empty($gaConf['trackDownloadsScript'])) {
                    $ret['ga.trackdownload'] = $this->serviceGoogleAnalyticsTrackDownloads($gaConf);
                }
            } elseif ($gaEnabled && $beLoggedIn) {
                // Disable caching
                $GLOBALS['TSFE']->set_no_cache('MetaSEO: Google Analytics code disabled, backend login detected');

                // Backend login detected, disable cache because this page is viewed by BE-users
                $ret['ga.disabled'] = '<!-- Google Analytics disabled, '
                    . 'Page cache disabled - Backend-Login detected -->';
            }
        }


        // #########################################
        // PIWIK
        // #########################################
        if (!empty($tsServices['piwik.'])
            && !empty($tsServices['piwik.']['url'])
            && !empty($tsServices['piwik.']['id'])
        ) {
            $piwikConf = $tsServices['piwik.'];

            $piwikEnabled = true;

            if ($disabledHeaderCode && empty($piwikConf['enableIfHeaderIsDisabled'])) {
                $piwikEnabled = false;
            }

            if ($piwikEnabled && !(empty($piwikConf['showIfBeLogin']) && $beLoggedIn)) {
                // Build Piwik service
                $ret['piwik'] = $this->buildPiwikCode($tsServices, $piwikConf);
            } elseif ($piwikEnabled && $beLoggedIn) {
                // Disable caching
                $GLOBALS['TSFE']->set_no_cache('MetaSEO: Piwik code disabled, backend login detected');

                // Backend login detected, disable cache because this page is viewed by BE-users
                $ret['piwik.disabled'] = '<!-- Piwik disabled, Page cache disabled - Backend-Login detected -->';
            }
        }

        // Call hook
        GeneralUtility::callHookAndSignal(__CLASS__, 'pageFooterOutput', $this, $ret);

        return implode("\n", $ret);
    }
public function main ( $ title ) { // INIT $ ret = array ( ) ; $ tsSetup = $ GLOBALS [ 'TSFE' ] -> tmpl -> setup ; $ tsServices = array ( ) ; $ beLoggedIn = isset ( $ GLOBALS [ 'BE_USER' ] -> user [ 'username' ] ) ; $ disabledHeaderCode = false ; if ( ! empty ( $ tsSetup [ 'config.' ] [ 'disableAllHeaderCode' ] ) ) { $ disabledHeaderCode = true ; } if ( ! empty ( $ tsSetup [ 'plugin.' ] [ 'metaseo.' ] [ 'services.' ] ) ) { $ tsServices = $ tsSetup [ 'plugin.' ] [ 'metaseo.' ] [ 'services.' ] ; } // Call hook GeneralUtility :: callHookAndSignal ( __CLASS__ , 'pageFooterSetup' , $ this , $ tsServices ) ; // ######################################### // GOOGLE ANALYTICS // ######################################### if ( ! empty ( $ tsServices [ 'googleAnalytics' ] ) ) { $ gaConf = $ tsServices [ 'googleAnalytics.' ] ; $ gaEnabled = true ; if ( $ disabledHeaderCode && empty ( $ gaConf [ 'enableIfHeaderIsDisabled' ] ) ) { $ gaEnabled = false ; } if ( $ gaEnabled && ! ( empty ( $ gaConf [ 'showIfBeLogin' ] ) && $ beLoggedIn ) ) { // Build Google Analytics service $ ret [ 'ga' ] = $ this -> buildGoogleAnalyticsCode ( $ tsServices , $ gaConf ) ; if ( ! empty ( $ gaConf [ 'trackDownloads' ] ) && ! empty ( $ gaConf [ 'trackDownloadsScript' ] ) ) { $ ret [ 'ga.trackdownload' ] = $ this -> serviceGoogleAnalyticsTrackDownloads ( $ gaConf ) ; } } elseif ( $ gaEnabled && $ beLoggedIn ) { // Disable caching $ GLOBALS [ 'TSFE' ] -> set_no_cache ( 'MetaSEO: Google Analytics code disabled, backend login detected' ) ; // Backend login detected, disable cache because this page is viewed by BE-users $ ret [ 'ga.disabled' ] = '<!-- Google Analytics disabled, ' . 'Page cache disabled - Backend-Login detected -->' ; } } // ######################################### // PIWIK // ######################################### if ( ! empty ( $ tsServices [ 'piwik.' ] ) && ! empty ( $ tsServices [ 'piwik.' ] [ 'url' ] ) && ! empty ( $ tsServices [ 'piwik.' ] [ 'id' ] ) ) { $ piwikConf = $ tsServices [ 'piwik.' ] ; $ piwikEnabled = true ; if ( $ disabledHeaderCode && empty ( $ piwikConf [ 'enableIfHeaderIsDisabled' ] ) ) { $ piwikEnabled = false ; } if ( $ piwikEnabled && ! ( empty ( $ piwikConf [ 'showIfBeLogin' ] ) && $ beLoggedIn ) ) { // Build Piwik service $ ret [ 'piwik' ] = $ this -> buildPiwikCode ( $ tsServices , $ piwikConf ) ; } elseif ( $ piwikEnabled && $ beLoggedIn ) { // Disable caching $ GLOBALS [ 'TSFE' ] -> set_no_cache ( 'MetaSEO: Piwik code disabled, backend login detected' ) ; // Backend login detected, disable cache because this page is viewed by BE-users $ ret [ 'piwik.disabled' ] = '<!-- Piwik disabled, Page cache disabled - Backend-Login detected -->' ; } } // Call hook GeneralUtility :: callHookAndSignal ( __CLASS__ , 'pageFooterOutput' , $ this , $ ret ) ; return implode ( "\n" , $ ret ) ; }
Add Page Footer

@param    string $title Default page title (rendered by TYPO3)

@return    string            Modified page title
Add Page Footer