From acfe7a03a71b0cf0db89debe976a907c3e6dd9f8 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Tue, 21 Nov 2017 19:59:43 +0200 Subject: [PATCH] Update plugin.php Site verification and tag insertion fixed. Code cleaning. --- bl-plugins/google/plugin.php | 147 +++++++++++++++++------------------ 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/bl-plugins/google/plugin.php b/bl-plugins/google/plugin.php index 124ac535..afac2f55 100644 --- a/bl-plugins/google/plugin.php +++ b/bl-plugins/google/plugin.php @@ -2,91 +2,90 @@ class pluginGoogle extends Plugin { - public function init() - { - $this->dbFields = array( - 'google-analytics-tracking-id'=>'', - 'google-site-verification'=>'', - 'google-tag-manager'=>'' - ); - } + public function init() + { + $this->dbFields = array( + 'google-site-verification'=>'', + 'google-analytics-tracking-id'=>'', + 'google-tag-manager'=>'' + ); + } - public function form() - { - global $Language; + public function form() + { + global $Language; - $html = '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-google-site-verification').''; - $html .= '
'; + $html = '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-google-site-verification').''; + $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; - $html .= '
'; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; + $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-tracking-id-google-tag').''; - $html .= '
'; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id-google-tag').''; + $html .= '
'; - return $html; - } + return $html; + } - public function siteHead() - { - global $Url; - global $WHERE_AM_I; + public function siteHead() + { + global $Url; - $html = ''; + $html = ""; - // Google HTML tag - if ($this->getValue('google-site-verification') && ($WHERE_AM_I=='home')) { - $html .= PHP_EOL.''.PHP_EOL; - $html .= ''.PHP_EOL; - } + // Google HTML tag + if( $this->getValue('google-site-verification') && $Url->whereAmI()=='home' ) { + $html .= PHP_EOL.""; + $html .= ''.PHP_EOL; + } - // Google Tag Manager - if( $this->getValue('google-tag-manager') ) { - $html .= PHP_EOL."".PHP_EOL; - $html .= "".PHP_EOL; - $html .= "".PHP_EOL; - } + // Google Tag Manager + if( $this->getValue('google-tag-manager') ) { + $html .= PHP_EOL.""; + $html .= "".PHP_EOL; + $html .= "".PHP_EOL; + } - // Google Analytics - if ($this->getValue('google-analytics-tracking-id')) { - $html = PHP_EOL.''.PHP_EOL; - $html .= ' - - + '.PHP_EOL; - } + gtag("config", "'.$this->getValue('google-analytics-tracking-id').'"); + '.PHP_EOL; + } - return $html; - } + return $html; + } - public function siteBodyBegin() - { - // Google Tag Manager - if ($this->getValue('google-tag-manager')) { - $html = ''.PHP_EOL; - $html .= ''.PHP_EOL; - $html .= ''.PHP_EOL; - return $html; - } - return false; - } + public function siteBodyBegin() + { + // Google Tag Manager + if ($this->getValue('google-tag-manager')) { + $html = ''; + $html .= ''.PHP_EOL; + $html .= ''.PHP_EOL; + return $html; + } + return false; + } -} \ No newline at end of file +}