[piwik] Update config file style/name

This commit is contained in:
Hypolite Petovan 2018-11-25 02:15:18 -05:00
parent 524937a830
commit 44d7a0b617
4 changed files with 46 additions and 42 deletions

View File

@ -20,20 +20,24 @@ Configuration
The easiest way to configure this addon is by activating the admin panels of your ~friendica server and then enter the needed details on the config page for the addon. The easiest way to configure this addon is by activating the admin panels of your ~friendica server and then enter the needed details on the config page for the addon.
If you don't want to use the admin panel, you can configure the addon through the config/local.ini.php file. If you don't want to use the admin panel, you can configure the addon through the `config/local.config.php` file.
Open the config/local.ini.php file and add "piwik" to the list of activated addons. Open the `config/local.config.php` file and add "piwik" to the list of activated addons.
[system] 'system' => [
addon = ...,piwik ...
'addon' => '...,piwik'
...
]
You can change 4 more configuration variables for the addon in the config/addon.ini.php file: You can change 4 more configuration variables for the addon in the `config/addon.config.php` file:
[piwik] 'piwik' => [
baseurl = example.com/piwik/ 'baseurl' => 'example.com/piwik/',
sideid = 1 'sideid' => 1,
optout = true 'optout' => true,
async = false 'async' => false,
],
Configuration fields Configuration fields
--------------------- ---------------------

View File

@ -0,0 +1,29 @@
<?php
// Warning: Don't change this file! It only holds the default config values for this addon.
// Instead overwrite these config values in config/addon.config.php in your Friendica directory
return [
'piwik' => [
// baseurl (String)
// This URL points to your Piwik installation.
// Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
// Example: baseurl = example.com/piwik/
'baseurl' => '',
// siteid (Integer)
// Change the *sideid* parameter to whatever ID you want to use for tracking your Friendica installation.
'sideid' => '',
// optout (Boolean)
// This defines whether or not a short notice about the utilization of Piwik will be displayed on every
// page of your Friendica site (at the bottom of the page with some spacing to the other content).
// Part of the note is a link that allows the visitor to set an opt-out cookie which will prevent visits
// from that user be tracked by Piwik.
'optout' => true,
// async (Boolean)
// This defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
'async' => false,
],
];

View File

@ -1,29 +0,0 @@
<?php return <<<INI
; Warning: Don't change this file! It only holds the default config values for this addon.
; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
[piwik]
; baseurl (String)
; This URL points to your Piwik installation.
; Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
; Example: baseurl = example.com/piwik/
baseurl =
; siteid (Integer)
; Change the *sideid* parameter to whatever ID you want to use for tracking your Friendica installation.
sideid =
; optout (Boolean)
; This defines whether or not a short notice about the utilization of Piwik will be displayed on every
; page of your Friendica site (at the bottom of the page with some spacing to the other content).
; Part of the note is a link that allows the visitor to set an opt-out cookie which will prevent visits
; from that user be tracked by Piwik.
optout = true
; async (Boolean)
; This defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
async = false
INI;
//Keep this line

View File

@ -16,7 +16,7 @@
* *
* Configuration: * Configuration:
* Use the administration panel to configure the Piwik tracking addon, or * Use the administration panel to configure the Piwik tracking addon, or
* in case you don't use this add the following lines to your config/addon.ini.php * in case you don't use this add the following lines to your config/addon.config.php
* file: * file:
* *
* [piwik] * [piwik]
@ -53,7 +53,7 @@ function piwik_uninstall() {
function piwik_load_config(\Friendica\App $a) function piwik_load_config(\Friendica\App $a)
{ {
$a->loadConfigFile(__DIR__. '/config/piwik.ini.php'); $a->loadConfigFile(__DIR__ . '/config/piwik.config.php');
} }
function piwik_analytics($a,&$b) { function piwik_analytics($a,&$b) {
@ -66,7 +66,7 @@ function piwik_analytics($a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/piwik/piwik.css' . '" media="all" />'; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/piwik/piwik.css' . '" media="all" />';
/* /*
* Get the configuration variables from the config/addon.ini.php file. * Get the configuration variables from the config/addon.config.php file.
*/ */
$baseurl = Config::get('piwik', 'baseurl'); $baseurl = Config::get('piwik', 'baseurl');
$siteid = Config::get('piwik', 'siteid'); $siteid = Config::get('piwik', 'siteid');