[geeklog-cvs] geeklog: New plugin API function PLG_getDocumentationUrl (featur...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Apr 11 13:45:19 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e7a542a82561
changeset: 6922:e7a542a82561
user: Dirk Haun <dirk at haun-online.de>
date: Sat Apr 11 18:52:02 2009 +0200
description:
New plugin API function PLG_getDocumentationUrl (feature request #0000848)
diffstat:
8 files changed, 165 insertions(+), 18 deletions(-)
plugins/calendar/functions.inc | 25 +++++++++++++++++++++++++
plugins/links/functions.inc | 25 +++++++++++++++++++++++++
plugins/polls/functions.inc | 25 +++++++++++++++++++++++++
plugins/spamx/functions.inc | 25 +++++++++++++++++++++++++
plugins/staticpages/functions.inc | 25 +++++++++++++++++++++++++
public_html/docs/history | 2 ++
system/classes/config.class.php | 25 ++++++++++++++-----------
system/lib-plugins.php | 31 ++++++++++++++++++++++++-------
diffs (289 lines):
diff -r 5dd79ca26230 -r e7a542a82561 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Sat Apr 11 17:55:09 2009 +0200
+++ b/plugins/calendar/functions.inc Sat Apr 11 18:52:02 2009 +0200
@@ -1899,4 +1899,29 @@
return $retval;
}
+/**
+* Provide URL of a documentation file
+*
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false when not available
+*
+*/
+function plugin_getdocumentationurl_calendar($file)
+{
+ global $_CONF;
+
+ switch ($file) {
+ case 'index':
+ case 'config':
+ $retval = $_CONF['site_url'] . '/docs/calendar.html';
+ break;
+
+ default:
+ $retval = false;
+ break;
+ }
+
+ return $retval;
+}
+
?>
diff -r 5dd79ca26230 -r e7a542a82561 plugins/links/functions.inc
--- a/plugins/links/functions.inc Sat Apr 11 17:55:09 2009 +0200
+++ b/plugins/links/functions.inc Sat Apr 11 18:52:02 2009 +0200
@@ -1626,4 +1626,29 @@
return $categorysql;
}
+/**
+* Provide URL of a documentation file
+*
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false when not available
+*
+*/
+function plugin_getdocumentationurl_links($file)
+{
+ global $_CONF;
+
+ switch ($file) {
+ case 'index':
+ case 'config':
+ $retval = $_CONF['site_url'] . '/docs/links.html';
+ break;
+
+ default:
+ $retval = false;
+ break;
+ }
+
+ return $retval;
+}
+
?>
diff -r 5dd79ca26230 -r e7a542a82561 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc Sat Apr 11 17:55:09 2009 +0200
+++ b/plugins/polls/functions.inc Sat Apr 11 18:52:02 2009 +0200
@@ -1321,4 +1321,29 @@
return $retval;
}
+/**
+* Provide URL of a documentation file
+*
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false when not available
+*
+*/
+function plugin_getdocumentationurl_polls($file)
+{
+ global $_CONF;
+
+ switch ($file) {
+ case 'index':
+ case 'config':
+ $retval = $_CONF['site_url'] . '/docs/polls.html';
+ break;
+
+ default:
+ $retval = false;
+ break;
+ }
+
+ return $retval;
+}
+
?>
diff -r 5dd79ca26230 -r e7a542a82561 plugins/spamx/functions.inc
--- a/plugins/spamx/functions.inc Sat Apr 11 17:55:09 2009 +0200
+++ b/plugins/spamx/functions.inc Sat Apr 11 18:52:02 2009 +0200
@@ -390,4 +390,29 @@
return $out;
}
+/**
+* Provide URL of a documentation file
+*
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false when not available
+*
+*/
+function plugin_getdocumentationurl_spamx($file)
+{
+ global $_CONF;
+
+ switch ($file) {
+ case 'index':
+ case 'config':
+ $retval = $_CONF['site_url'] . '/docs/spamx.html';
+ break;
+
+ default:
+ $retval = false;
+ break;
+ }
+
+ return $retval;
+}
+
?>
diff -r 5dd79ca26230 -r e7a542a82561 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Sat Apr 11 17:55:09 2009 +0200
+++ b/plugins/staticpages/functions.inc Sat Apr 11 18:52:02 2009 +0200
@@ -1327,4 +1327,29 @@
return $retval;
}
+/**
+* Provide URL of a documentation file
+*
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false when not available
+*
+*/
+function plugin_getdocumentationurl_staticpages($file)
+{
+ global $_CONF;
+
+ switch ($file) {
+ case 'index':
+ // TBD: case 'config':
+ $retval = $_CONF['site_url'] . '/docs/staticpages.html';
+ break;
+
+ default:
+ $retval = false;
+ break;
+ }
+
+ return $retval;
+}
+
?>
diff -r 5dd79ca26230 -r e7a542a82561 public_html/docs/history
--- a/public_html/docs/history Sat Apr 11 17:55:09 2009 +0200
+++ b/public_html/docs/history Sat Apr 11 18:52:02 2009 +0200
@@ -11,6 +11,8 @@
+ Comment moderation and editable comments, by Jared Wenerd
Other changes:
+- New plugin API function PLG_getDocumentationUrl (feature request #0000848)
+ [Dirk]
- Fresh installs + MySQL only: Changed some tinyint fields that are only used
as flags to tinyint(1) from tinyint(3) (bug #0000857)
- Fixed one of the predefined date format strings (bug #0000854)
diff -r 5dd79ca26230 -r e7a542a82561 system/classes/config.class.php
--- a/system/classes/config.class.php Sat Apr 11 17:55:09 2009 +0200
+++ b/system/classes/config.class.php Sat Apr 11 18:52:02 2009 +0200
@@ -2,13 +2,13 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
+// | Geeklog 1.6 |
// +---------------------------------------------------------------------------+
// | config.class.php |
// | |
// | Controls the UI and database for configuration settings |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2007-2008 by the following authors: |
+// | Copyright (C) 2007-2009 by the following authors: |
// | |
// | Authors: Aaron Blankstein - kantai AT gmail DOT com |
// +---------------------------------------------------------------------------+
@@ -28,8 +28,6 @@
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
-//
-// $Id: config.class.php,v 1.50 2008/08/31 19:17:39 dhaun Exp $
class config {
var $dbconfig_file;
@@ -640,18 +638,23 @@
$on = $name;
}
if (! is_numeric($on)) {
- if (!empty($GLOBALS['_CONF']['site_url'])) {
- $baseUrl = $GLOBALS['_CONF']['site_url'];
+ if ($group == 'Core') {
+ if (!empty($GLOBALS['_CONF']['site_url'])) {
+ $baseUrl = $GLOBALS['_CONF']['site_url'];
+ } else {
+ $baseUrl = 'http://www.geeklog.net';
+ }
+ $descUrl = $baseUrl . '/docs/config.html#desc_' . $o;
} else {
- $baseUrl = 'http://www.geeklog.net';
+ $descUrl = PLG_getDocumentationUrl($group, 'config');
+ if (! empty($descUrl)) {
+ $descUrl .= '#desc_' . $o;
+ }
}
- if ($group == 'Core') {
- $descUrl = $baseUrl . '/docs/config.html#desc_' . $o;
+ if (! empty($descUrl)) {
$t->set_var('doc_url', $descUrl);
$t->set_var('doc_link',
'(<a href="' . $descUrl . '" target="help">?</a>)');
- } else {
- // TBD: link to description of plugin option
}
}
}
diff -r 5dd79ca26230 -r e7a542a82561 system/lib-plugins.php
--- a/system/lib-plugins.php Sat Apr 11 17:55:09 2009 +0200
+++ b/system/lib-plugins.php Sat Apr 11 18:52:02 2009 +0200
@@ -2362,7 +2362,7 @@
. $type . '.gif';
$fh = @fopen ($icon, 'r');
if ($fh === false) {
- // give up and us a generic icon
+ // give up and use a generic icon
$retval = $_CONF['site_url'] . '/images/icons/plugins.gif';
} else {
$retval = $icon;
@@ -2380,12 +2380,12 @@
/**
* Invoke a service
*
- * @param string type The plugin type whose service is to be called
- * @param string action The service action to be performed
- * @param array args The arguments to be passed to the service invoked
- * @param array output The output variable that will contain the output after invocation
- * @param array svc_msg The output variable that will contain the service messages
- * @return int The result of the invocation
+ * @param string $type The plugin type whose service is to be called
+ * @param string $action The service action to be performed
+ * @param array $args The arguments to be passed to the service invoked
+ * @param array $output The output variable that will contain the output after invocation
+ * @param array $svc_msg The output variable that will contain the service messages
+ * @return int The result of the invocation
* @link http://wiki.geeklog.net/index.php/Webservices_API
*
*/
@@ -2555,4 +2555,21 @@
}
}
+/**
+* Ask plugin for the URL to its documentation
+*
+* @param string $type plugin name
+* @param string $file documentation file being requested, e.g. 'config'
+* @return mixed URL or false / empty string when not available
+* @since Geeklog 1.6.0
+*
+*/
+function PLG_getDocumentationUrl($type, $file)
+{
+ $args[1] = $file;
+ $function = 'plugin_getdocumentationurl_' . $type;
+
+ return PLG_callFunctionForOnePlugin($function, $args);
+}
+
?>
More information about the geeklog-cvs
mailing list