diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index a0cc58eb24f..2b8c75ebba7 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -4345,4 +4345,86 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
}
}
+/**
+ * Print common footer :
+ * conf->global->MAIN_HTML_FOOTER
+ * conf->global->MAIN_GOOGLE_AN_ID
+ * DOL_TUNING
+ * conf->logbuffer
+ *
+ * @param string $zone 'private' (for private pages) or 'public' (for public pages)
+ * @return void
+ */
+function printCommonFooter($zone='private')
+{
+ global $conf;
+
+ if ($zone == 'private') print "\n".''."\n";
+ else print "\n".''."\n";
+
+ if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
+
+ // Google Analytics (need Google module)
+ if (! empty($conf->global->MAIN_GOOGLE_AN_ID))
+ {
+ print "\n";
+ print ''."\n";
+ }
+
+ // End of tuning
+ if (! empty($_SERVER['DOL_TUNING']))
+ {
+ $micro_end_time=dol_microtime_float(true);
+ print "\n".''."\n";
+
+ // Add Xdebug coverage of code
+ if (defined('XDEBUGCOVERAGE')) {
+ var_dump(xdebug_get_code_coverage());
+ }
+ }
+
+ // If there is some logs in buffer to show
+ if (count($conf->logbuffer))
+ {
+ print "\n";
+ print "\n";
+ }
+
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 54ccf671c4b..4bdba0edc70 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1624,50 +1624,7 @@ if (! function_exists("llxFooter"))
print "\n";
if ($foot) print ''."\n";
- if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
-
-
- // If there is some logs in buffer to show
- if (count($conf->logbuffer))
- {
- print "\n";
- print "\n";
- }
-
- // End of tuning
- if (! empty($_SERVER['DOL_TUNING']))
- {
- $micro_end_time=dol_microtime_float(true);
- print "\n".''."\n";
-
- // Add Xdebug coverage of code
- if (defined('XDEBUGCOVERAGE')) { var_dump(xdebug_get_code_coverage()); }
- }
+ printCommonFooter();
print "