]> git.mxchange.org Git - friendica.git/commitdiff
admin interface stuff for the piwik addon
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 23 Jun 2011 18:47:24 +0000 (20:47 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 23 Jun 2011 18:47:24 +0000 (20:47 +0200)
addon/piwik/admin.tpl [new file with mode: 0644]
addon/piwik/piwik.php

diff --git a/addon/piwik/admin.tpl b/addon/piwik/admin.tpl
new file mode 100644 (file)
index 0000000..e7a281e
--- /dev/null
@@ -0,0 +1,4 @@
+{{ inc field_input.tpl with $field=$baseurl }}{{ endinc }}
+{{ inc field_input.tpl with $field=$sideid }}{{ endinc }}
+{{ inc field_checkbox.tpl with $field=$optout }}{{ endinc }}
+<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
index 032f84f4bb29f8533419e7ea9eb6d4b1f36b7be7..94aa9b55c0d5dd1c43d1825e81487597df3bf1e2 100644 (file)
@@ -70,4 +70,21 @@ function piwik_analytics($a,&$b) {
        }
 
 }
-
+function piwik_plugin_admin (&$a, &$o) {
+    $t = file_get_contents( dirname(__file__)."/admin.tpl");
+    $o = replace_macros( $t, array(
+            '$submit' => t('Submit'),
+            '$baseurl' => array('baseurl', t('Piwik Base URL'), get_config('piwik','baseurl' ), ''),
+            '$sideid' => array('sideid', t('Side ID'), get_config('piwik','sideid' ), ''),
+            '$optout' => array('optout', t('Show opt-out cookie link?'), get_config('piwik','optout' ), ''),
+        ));
+}
+function piwik_plugin_admin_post (&$a) {
+    $url = ((x($_POST, 'baseurl')) ? notags(trim($_POST['baseurl'])) : '');
+    $id = ((x($_POST, 'sideid')) ? trim($_POST['sideid']) : '');
+    $optout = ((x($_POST, 'optout')) ? trim($_POST['optout']) : '');
+    set_config('piwik', 'baseurl', $url);
+    set_config('piwik', 'sideid', $id);
+    set_config('piwik', 'optout', $optout);
+    info( t('Settings updated.'). EOL);
+}