aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-12-24 23:44:17 -0800
committerFriendika <info@friendika.com>2010-12-24 23:44:17 -0800
commitd045fd04d4b42a749a113dd27f439f9766800975 (patch)
tree78ab3b0ecaea1695249fe862bf051d1d616937dc
parent6891d44e0b765d230bd3b483c5e283647947c4cb (diff)
downloadvolse-hubzilla-d045fd04d4b42a749a113dd27f439f9766800975.tar.gz
volse-hubzilla-d045fd04d4b42a749a113dd27f439f9766800975.tar.bz2
volse-hubzilla-d045fd04d4b42a749a113dd27f439f9766800975.zip
provide separate plugin settings page, update demo plugin, fix hook_register
-rw-r--r--addon/randplace/randplace.php14
-rw-r--r--boot.php2
-rw-r--r--mod/settings.php18
-rw-r--r--util/strings.php2
-rw-r--r--view/en/settings.tpl2
-rw-r--r--view/it/settings.tpl3
-rw-r--r--view/it/strings.php2
-rw-r--r--view/theme/default/style.css5
8 files changed, 40 insertions, 8 deletions
diff --git a/addon/randplace/randplace.php b/addon/randplace/randplace.php
index e14ae74c7..6203dab8f 100644
--- a/addon/randplace/randplace.php
+++ b/addon/randplace/randplace.php
@@ -36,13 +36,13 @@ function randplace_install() {
/**
*
- * Then we'll attach into the settings page, on both the
- * form and post hooks so that we can create and update
+ * Then we'll attach into the plugin settings page, and also the
+ * settings post hooks so that we can create and update
* user preferences.
*
*/
- register_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings');
+ register_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings');
register_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
logger("installed randplace");
@@ -60,7 +60,7 @@ function randplace_uninstall() {
*/
unregister_hook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook');
- unregister_hook('settings_form', 'addon/randplace/randplace.php', 'randplace_settings');
+ unregister_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings');
unregister_hook('settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
@@ -154,7 +154,7 @@ function randplace_settings(&$a,&$s) {
if(! local_user())
return;
- /* Add our stylesheet so we can match the page layout */
+ /* Add our stylesheet so we can make our settings look nice */
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/randplace/randplace.css' . '" media="all" />' . "\r\n";
@@ -164,7 +164,7 @@ function randplace_settings(&$a,&$s) {
$checked = (($enabled) ? ' checked="checked" ' : '');
- /* Add some HTML to the form */
+ /* Add some HTML to the existing form */
$s .= '<h3>' . t('Randplace Settings') . '</h3>';
$s .= '<div id="randplace-enable-wrapper">';
@@ -172,7 +172,7 @@ function randplace_settings(&$a,&$s) {
$s .= '<input id="randplace-checkbox" type="checkbox" name="randplace" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';
- /* provide another submit button */
+ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
diff --git a/boot.php b/boot.php
index c34002809..7b7adba82 100644
--- a/boot.php
+++ b/boot.php
@@ -2047,7 +2047,7 @@ function profile_sidebar($profile) {
if(! function_exists('register_hook')) {
function register_hook($hook,$file,$function) {
- $r = q("SELECT FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1",
dbesc($hook),
dbesc($file),
dbesc($function)
diff --git a/mod/settings.php b/mod/settings.php
index b10f9e3fc..000258db9 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -17,6 +17,9 @@ function settings_post(&$a) {
call_hooks('settings_post', $_POST);
+ if(($a->argc > 1) && ($a->argv[1] == 'addon'))
+ return;
+
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
notice( t('Permission denied.') . EOL);
return;
@@ -182,6 +185,21 @@ function settings_content(&$a) {
return;
}
+ if(($a->argc > 1) && ($a->argv[1] === 'addon')) {
+ $o .= '<h1>' . t('Plugin Settings') . '</h1>';
+ $o .= '<div id="account-settings-link"><a href="settings">' . t('Account Settings') . '</a></div>';
+
+ $o .= '<form action="settings/addon" method="post" >';
+
+ $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
+ if(! count($r))
+ notice('No Plugin settings configured');
+
+ call_hooks('plugin_settings', $o);
+ $o .= '</form>';
+ return $o;
+ }
+
require_once('include/acl_selectors.php');
$p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
diff --git a/util/strings.php b/util/strings.php
index e776d052f..f42449690 100644
--- a/util/strings.php
+++ b/util/strings.php
@@ -328,6 +328,8 @@ $a->strings[' Please use a shorter name.'] = ' Please use a shorter name.';
$a->strings[' Name too short.'] = ' Name too short.';
$a->strings[' Not valid email.'] = ' Not valid email.';
$a->strings['Settings updated.'] = 'Settings updated.';
+$a->strings['Plugin Settings'] = 'Plugin Settings';
+$a->strings['Account Settings'] = 'Account Settings';
$a->strings['OpenID: '] = 'OpenID: ';
$a->strings["&nbsp;\x28Optional\x29 Allow this OpenID to login to this account."] = "&nbsp;\x28Optional\x29 Allow this OpenID to login to this account.";
$a->strings['Profile is <strong>not published</strong>.'] = 'Profile is <strong>not published</strong>.';
diff --git a/view/en/settings.tpl b/view/en/settings.tpl
index 594ce73fc..5e1bfabf4 100644
--- a/view/en/settings.tpl
+++ b/view/en/settings.tpl
@@ -1,5 +1,7 @@
<h1>Account Settings</h1>
+<div id="plugin-settings-link"><a href="settings/addon">Plugin Settings</a></div>
+
$nickname_block
diff --git a/view/it/settings.tpl b/view/it/settings.tpl
index 364fd6ba2..365e5cb70 100644
--- a/view/it/settings.tpl
+++ b/view/it/settings.tpl
@@ -1,5 +1,8 @@
<h1>Impostazioni account</h1>
+<div id="plugin-settings-link"><a href="settings/addon">Impostazioni Plugin</a></div>
+
+
$nickname_block
diff --git a/view/it/strings.php b/view/it/strings.php
index 2b1a3c830..3640997d9 100644
--- a/view/it/strings.php
+++ b/view/it/strings.php
@@ -324,6 +324,8 @@ $a->strings[' Please use a shorter name.'] = ' Usa un nome pi&ugrave; corto.';
$a->strings[' Name too short.'] = ' Nome troppo corto.';
$a->strings[' Not valid email.'] = ' Email non valida.';
$a->strings['Settings updated.'] = 'Impostazioni aggiornate.';
+$a->strings['Plugin Settings'] = 'Impostazioni Plugin';
+$a->strings['Account Settings'= = 'Impostazioni Account';
$a->strings['OpenID: '] = 'OpenID: ';
$a->strings["&nbsp;\x28Optional\x29 Allow this OpenID to login to this account."] = "&nbsp;\x28Opzionale\x29 Permetti a questo OpenID di accedere a questo account.";
$a->strings['Profile is <strong>not published</strong>.'] = 'Il profilo <strong>non &egrave; pubblicato</strong>.';
diff --git a/view/theme/default/style.css b/view/theme/default/style.css
index 086f59c30..240ace896 100644
--- a/view/theme/default/style.css
+++ b/view/theme/default/style.css
@@ -1952,3 +1952,8 @@ a.mail-list-link {
margin-top: 50px;
font-size: 70%;
}
+
+
+#plugin-settings-link, #account-settings-link {
+ margin-bottom: 25px;
+}