diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-06 14:08:06 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-06 14:08:06 +0000 |
commit | aeadc1f9129274949daaa57738c7c4550bdfbc7b (patch) | |
tree | 08dadf5ef7474fc41d1d48f74648f1ba8b55f34d /plugins/sonar-googleanalytics-plugin/src | |
download | sonarqube-aeadc1f9129274949daaa57738c7c4550bdfbc7b.tar.gz sonarqube-aeadc1f9129274949daaa57738c7c4550bdfbc7b.zip |
SONAR-236 remove deprecated code from checkstyle plugin + display default value of rule parameters in Q profile console
Diffstat (limited to 'plugins/sonar-googleanalytics-plugin/src')
2 files changed, 120 insertions, 0 deletions
diff --git a/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsPlugin.java b/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsPlugin.java new file mode 100644 index 00000000000..79fa7cd1c73 --- /dev/null +++ b/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsPlugin.java @@ -0,0 +1,57 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.googleanalytics; + +import org.sonar.api.*; + +import java.util.ArrayList; +import java.util.List; + +@Properties({ + @Property( + key = CoreProperties.GOOGLE_ANALYTICS_ACCOUNT_PROPERTY, + name = "Account key", + description = "Example : UA-1234567-8") +}) +public class GoogleAnalyticsPlugin implements Plugin { + + public String getKey() { + return CoreProperties.GOOGLE_ANALYTICS_PLUGIN; + } + + public String getName() { + return "Google analytics"; + } + + public String getDescription() { + return "Google analytics is a tool that collects data on the traffic of web sites and then, through a powerful interface, enables to get reporting, segmentation, chart, .. on the traffic. You can find more by going to the <a href='http://www.google.com/analytics/'>Google analytics web site</a>."; + } + + public List<Class<? extends Extension>> getExtensions() { + List<Class<? extends Extension>> list = new ArrayList<Class<? extends Extension>>(); + list.add(GoogleAnalyticsWebFooter.class); + return list; + } + + @Override + public String toString() { + return getKey(); + } +} diff --git a/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsWebFooter.java b/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsWebFooter.java new file mode 100644 index 00000000000..a2059a70fb7 --- /dev/null +++ b/plugins/sonar-googleanalytics-plugin/src/main/java/org/sonar/plugins/googleanalytics/GoogleAnalyticsWebFooter.java @@ -0,0 +1,63 @@ +/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.googleanalytics;
+
+import org.apache.commons.configuration.Configuration;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.web.Footer;
+
+public class GoogleAnalyticsWebFooter implements Footer {
+
+ private Configuration configuration;
+
+ public GoogleAnalyticsWebFooter(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ protected String getIdAccount() {
+ return configuration.getString(CoreProperties.GOOGLE_ANALYTICS_ACCOUNT_PROPERTY, "");
+ }
+
+ public String getKey() {
+ return "webfooter_" + CoreProperties.GOOGLE_ANALYTICS_PLUGIN;
+ }
+
+ public String getHtml() {
+ String id = getIdAccount();
+ if (id != null && !"".equals(id)) {
+ return "<script type=\"text/javascript\">\n" +
+ "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n" +
+ "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n" +
+ "</script>\n" +
+ "<script type=\"text/javascript\">\n" +
+ "var pageTracker = _gat._getTracker(\"" + id + "\");\n" +
+ "pageTracker._initData();\n" +
+ "pageTracker._trackPageview();\n" +
+ "</script>";
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return getKey();
+ }
+
+}
|