From 505d242cbde65e4a9ccd13e83966893b01b82568 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 3 Nov 2013 15:08:46 +0100 Subject: [PATCH 1/4] [FEATURE] Added Google Analytics --- public/include/config/admin_settings.inc.php | 15 +++++++++++++++ public/include/smarty_globals.inc.php | 4 ++++ public/templates/mmcFE/admin/settings/default.tpl | 2 ++ public/templates/mmcFE/master.tpl | 7 ++++++- public/templates/mobile/master.tpl | 7 ++++++- public/templates/mpos/admin/settings/default.tpl | 2 ++ public/templates/mpos/master.tpl | 5 +++++ 7 files changed, 40 insertions(+), 2 deletions(-) diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index d6432b53..ce4a8e14 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -263,6 +263,21 @@ $aSettings['recaptcha'][] = array( 'name' => 'recaptcha_public_key', 'value' => $setting->getValue('recaptcha_public_key'), 'tooltip' => 'Your public key as given by your re-Captcha account.' ); +$aSettings['analytics'][] = array( + 'display' => 'Enable Google analytics', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'analytics_enabled', 'value' => $setting->getValue('analytics_enabled'), + 'tooltip' => 'Enable or Disable Google Analytics.' +); +$aSettings['analytics'][] = array( + 'display' => 'Google Analytics Code', 'type' => 'textarea', + 'size' => 5, + 'height' => 10, + 'default' => 'Code from Google Analytics', + 'name' => 'analytics_code', 'value' => $setting->getValue('analytics_code'), + 'tooltip' => '.' +); $aSettings['monitoring'][] = array( 'display' => 'Uptime Robot Private API Key', 'type' => 'text', 'size' => 25, diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index c53fc029..2a91f6e9 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -92,6 +92,10 @@ $aGlobal['website']['chaininfo']['disabled'] = $setting->getValue('website_chain $setting->getValue('website_blockexplorer_url') ? $aGlobal['website']['blockexplorer']['url'] = $setting->getValue('website_blockexplorer_url') : $aGlobal['website']['blockexplorer']['url'] = 'http://explorer.litecoin.net/block/'; $setting->getValue('website_chaininfo_url') ? $aGlobal['website']['chaininfo']['url'] = $setting->getValue('website_chaininfo_url') : $aGlobal['website']['chaininfo']['url'] = 'http://allchains.info'; +// Google Analytics +$aGlobal['analytics']['enabled'] = $setting->getValue('analytics_enabled'); +$aGlobal['analytics']['code'] = $setting->getValue('analytics_code'); + // ACLs $aGlobal['acl']['pool']['statistics'] = $setting->getValue('acl_pool_statistics'); $aGlobal['acl']['block']['statistics'] = $setting->getValue('acl_block_statistics'); diff --git a/public/templates/mmcFE/admin/settings/default.tpl b/public/templates/mmcFE/admin/settings/default.tpl index 519fb96e..2c21a5eb 100644 --- a/public/templates/mmcFE/admin/settings/default.tpl +++ b/public/templates/mmcFE/admin/settings/default.tpl @@ -21,6 +21,8 @@ {html_options name="data[{$SETTINGS.$TAB[setting].name}]" options=$SETTINGS.$TAB[setting].options selected=$SETTINGS.$TAB[setting].value|default:$SETTINGS.$TAB[setting].default} {else if $SETTINGS.$TAB[setting].type == 'text'} + {else if $SETTINGS.$TAB[setting].type == 'textarea'} + {else} Unknown option type: {$SETTINGS.$TAB[setting].type} {/if} diff --git a/public/templates/mmcFE/master.tpl b/public/templates/mmcFE/master.tpl index 28a6a26d..e5eafafa 100644 --- a/public/templates/mmcFE/master.tpl +++ b/public/templates/mmcFE/master.tpl @@ -23,7 +23,12 @@ @import url("{$PATH}/css/date_input.css"); - + + {if $GLOBAL.analytics.enabled} + {$GLOBAL.analytics.code} + {/if} + +
diff --git a/public/templates/mobile/master.tpl b/public/templates/mobile/master.tpl index a68d351e..20bc62a9 100644 --- a/public/templates/mobile/master.tpl +++ b/public/templates/mobile/master.tpl @@ -28,7 +28,12 @@ {/literal} {/if} - + + {if $GLOBAL.analytics.enabled} + {$GLOBAL.analytics.code} + {/if} + +
{if $smarty.session.AUTHENTICATED|default:"0" == 1} diff --git a/public/templates/mpos/admin/settings/default.tpl b/public/templates/mpos/admin/settings/default.tpl index 9cc1f97e..af6f053c 100644 --- a/public/templates/mpos/admin/settings/default.tpl +++ b/public/templates/mpos/admin/settings/default.tpl @@ -22,6 +22,8 @@ {html_options name="data[{$SETTINGS.$TAB[setting].name}]" options=$SETTINGS.$TAB[setting].options selected=$SETTINGS.$TAB[setting].value|default:$SETTINGS.$TAB[setting].default} {else if $SETTINGS.$TAB[setting].type == 'text'} + {else if $SETTINGS.$TAB[setting].type == 'textarea'} + {else} Unknown option type: {$SETTINGS.$TAB[setting].type} {/if} diff --git a/public/templates/mpos/master.tpl b/public/templates/mpos/master.tpl index b7d7e301..0fcfdde3 100644 --- a/public/templates/mpos/master.tpl +++ b/public/templates/mpos/master.tpl @@ -27,6 +27,11 @@ + + {if $GLOBAL.analytics.enabled} + {$GLOBAL.analytics.code} + {/if} +