New plugin Google Tools
This commit is contained in:
parent
c93e044128
commit
1e2692dd55
@ -333,10 +333,6 @@ class dbPages extends dbJSON
|
||||
}
|
||||
}
|
||||
|
||||
$fields['status'] = CLI_STATUS;
|
||||
$fields['date'] = Date::current(DB_DATE_FORMAT);
|
||||
$fields['username'] = 'admin';
|
||||
|
||||
//$tmpPaths = glob(PATH_PAGES.'*', GLOB_ONLYDIR);
|
||||
$tmpPaths = Filesystem::listDirectories(PATH_PAGES);
|
||||
foreach($tmpPaths as $directory)
|
||||
@ -364,7 +360,14 @@ class dbPages extends dbJSON
|
||||
|
||||
foreach($newPaths as $key=>$value)
|
||||
{
|
||||
if(!isset($this->db[$key])) {
|
||||
if(!isset($this->db[$key]))
|
||||
{
|
||||
// Default values for the new pages.
|
||||
$fields['status'] = CLI_STATUS;
|
||||
$fields['date'] = Date::current(DB_DATE_FORMAT);
|
||||
$fields['username'] = 'admin';
|
||||
|
||||
// Create the entry for the new page.
|
||||
$this->db[$key] = $fields;
|
||||
}
|
||||
|
||||
|
16
plugins/googletools/languages/en_US.json
Normal file
16
plugins/googletools/languages/en_US.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Tools",
|
||||
"description": "This plugin generate the meta tag to validate your site with Google Webmasters Tools and the JavaScript code to track your site with Google Analytics.",
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "",
|
||||
"version": "1.0",
|
||||
"releaseDate": "2015-09-28"
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics."
|
||||
}
|
11
plugins/googletools/languages/es_AR.json
Normal file
11
plugins/googletools/languages/es_AR.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Herramientas de Google",
|
||||
"description": "Este plugin genera los meta tags para validar el sitio con Google Webmasters Tools y el codigo JavaScript para trackear el sitio con Google Analytics."
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete este campo con el código de verificación de Google Webmasters Tools para verificar la propiedad del sitio.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete este campo con el Tracking ID para generar el código Javascript para trackear el sitio."
|
||||
}
|
63
plugins/googletools/plugin.php
Normal file
63
plugins/googletools/plugin.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
class pluginGoogleTools extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'tracking-id'=>'',
|
||||
'google-site-verification'=>''
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label for="jsgoogle-site-verification">'.$Language->get('Google Webmasters tools').'</label>';
|
||||
$html .= '<input id="jsgoogle-site-verification" type="text" name="google-site-verification" value="'.$this->getDbField('google-site-verification').'">';
|
||||
$html .= '<div class="forms-desc">'.$Language->get('complete-this-field-with-the-google-site-verification').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||
$html .= '<input id="jstracking-id" type="text" name="tracking-id" value="'.$this->getDbField('tracking-id').'">';
|
||||
$html .= '<div class="forms-desc">'.$Language->get('complete-this-field-with-the-tracking-id').'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteHead()
|
||||
{
|
||||
$html = PHP_EOL.'<!-- Google Webmasters Tools -->'.PHP_EOL;
|
||||
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'">'.PHP_EOL;
|
||||
|
||||
if(Text::isEmpty($this->getDbField('google-site-verification'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteBodyEnd()
|
||||
{
|
||||
$html = PHP_EOL.'<!-- Google Analytics -->'.PHP_EOL;
|
||||
$html .= "<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '".$this->getDbField('tracking-id')."', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>".PHP_EOL;
|
||||
|
||||
if(Text::isEmpty($this->getDbField('tracking-id'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user