[geeklog-cvs] geeklog: Added a PLG_getFooterCode function and corresponding {p...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Jan 22 16:40:55 EST 2011
changeset 8065:1e52ae316afe
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/1e52ae316afe
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 22 22:39:45 2011 +0100
description:
Added a PLG_getFooterCode function and corresponding {plg_footercode} variable in footer.thtml (based on patch #0000906, provided by hiroron)
diffstat:
public_html/docs/history | 4 +++
public_html/layout/professional/footer.thtml | 1 +
public_html/lib-common.php | 3 ++
system/lib-plugins.php | 29 ++++++++++++++++++++++++++++
4 files changed, 37 insertions(+), 0 deletions(-)
diffs (76 lines):
diff -r c714dca14441 -r 1e52ae316afe public_html/docs/history
--- a/public_html/docs/history Sat Jan 22 19:04:49 2011 +0100
+++ b/public_html/docs/history Sat Jan 22 22:39:45 2011 +0100
@@ -3,6 +3,10 @@
Apr ??, 2011 (1.8.0)
------------
+- Added a PLG_getFooterCode function and corresponding {plg_footercode}
+ variable in footer.thtml. This will allow plugins to add code to a site's
+ footer, e.g. to load JavaScript code as late as possible (based on patch
+ #0000906, provided by hiroron) [Dirk]
- Introduced COM_versionCompare() to compare Geeklog version numbers, since
they can't be compared using the PHP version_compare() function (feature
request #0000866, patch provided by Rouslan Placella)
diff -r c714dca14441 -r 1e52ae316afe public_html/layout/professional/footer.thtml
--- a/public_html/layout/professional/footer.thtml Sat Jan 22 19:04:49 2011 +0100
+++ b/public_html/layout/professional/footer.thtml Sat Jan 22 22:39:45 2011 +0100
@@ -14,5 +14,6 @@
</td>
</tr>
</table>
+{plg_footercode}
</body>
</html>
diff -r c714dca14441 -r 1e52ae316afe public_html/lib-common.php
--- a/public_html/lib-common.php Sat Jan 22 19:04:49 2011 +0100
+++ b/public_html/lib-common.php Sat Jan 22 22:39:45 2011 +0100
@@ -1504,6 +1504,9 @@
// Call to plugins to set template variables in the footer
PLG_templateSetVars( 'footer', $footer );
+ // Call any plugin that may want to include extra JavaScript functions
+ $footer->set_var('plg_footercode', PLG_getFooterCode());
+
// Actually parse the template and make variable substitutions
$footer->parse( 'index_footer', 'footer' );
diff -r c714dca14441 -r 1e52ae316afe system/lib-plugins.php
--- a/system/lib-plugins.php Sat Jan 22 19:04:49 2011 +0100
+++ b/system/lib-plugins.php Sat Jan 22 22:39:45 2011 +0100
@@ -1497,6 +1497,35 @@
}
/**
+* This function is called from COM_siteFooter and will return additional footer
+* information. This can be used for JavaScript functions required for the plugin
+*
+* @return string returns a concatenated string of all plugins extra footer code
+* @since Geeklog 1.8.0
+*
+*/
+function PLG_getFooterCode()
+{
+ global $_PLUGINS;
+
+ $footercode = '';
+
+ foreach ($_PLUGINS as $pi_name) {
+ $function = 'plugin_getfootercode_' . $pi_name;
+ if (function_exists($function)) {
+ $footercode .= $function();
+ }
+ }
+
+ $function = 'CUSTOM_getfootercode';
+ if (function_exists($function)) {
+ $footercode .= $function();
+ }
+
+ return $footercode;
+}
+
+/**
* Get a list of all currently supported autolink tags.
*
* Returns an associative array where $A['tag-name'] = 'plugin-name'
More information about the geeklog-cvs
mailing list