summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc4
-rw-r--r--modules/blog.module2
-rw-r--r--modules/blog/blog.module2
-rw-r--r--modules/book.module2
-rw-r--r--modules/book/book.module2
-rw-r--r--modules/comment.module4
-rw-r--r--modules/comment/comment.module4
-rw-r--r--modules/filter.module41
-rw-r--r--modules/filter/filter.module41
-rw-r--r--modules/story.module2
-rw-r--r--modules/story/story.module2
11 files changed, 86 insertions, 20 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 8d6cdcc41..bc8c57564 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -934,10 +934,6 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $
return form_select($title, $name, $value, $weights, $description, $extra);
}
-
-function form_allowed_tags_text() {
- return variable_get("allowed_html", "") ? (t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))) : "";
-}
/* @} */
/**
diff --git a/modules/blog.module b/modules/blog.module
index 9b091b735..159b7ff98 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -184,7 +184,7 @@ function blog_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 9b091b735..159b7ff98 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -184,7 +184,7 @@ function blog_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
diff --git a/modules/book.module b/modules/book.module
index b97c76f5d..92abb07db 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -185,7 +185,7 @@ function book_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("book", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, filter_tips_short());
$output .= form_textarea(t("Log message"), "log", $node->log, 60, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
if (user_access("administer nodes")) {
diff --git a/modules/book/book.module b/modules/book/book.module
index b97c76f5d..92abb07db 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -185,7 +185,7 @@ function book_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("book", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 20, filter_tips_short());
$output .= form_textarea(t("Log message"), "log", $node->log, 60, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
if (user_access("administer nodes")) {
diff --git a/modules/comment.module b/modules/comment.module
index 4e78e7677..9c937dde0 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -150,7 +150,7 @@ function comment_user($type, $edit, &$user) {
break;
case "edit_form":
// when user tries to edit his own data
- return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". form_allowed_tags_text());
+ return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short());
case "edit_validate":
// validate user data editing
return array("signature" => $edit["signature"]);
@@ -1259,7 +1259,7 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t("Subject"), "subject", $edit["subject"], 50, 64);
// comment field:
- $form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, form_allowed_tags_text());
+ $form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, filter_tips_short());
// preview button:
$form .= form_hidden("cid", $edit["cid"]);
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 4e78e7677..9c937dde0 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -150,7 +150,7 @@ function comment_user($type, $edit, &$user) {
break;
case "edit_form":
// when user tries to edit his own data
- return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". form_allowed_tags_text());
+ return form_textarea(t("Signature"), "signature", $user->signature, 70, 3, t("Your signature will be publicly displayed at the end of your comments.") ."<br />". filter_tips_short());
case "edit_validate":
// validate user data editing
return array("signature" => $edit["signature"]);
@@ -1259,7 +1259,7 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t("Subject"), "subject", $edit["subject"], 50, 64);
// comment field:
- $form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, form_allowed_tags_text());
+ $form .= form_textarea(t("Comment"), "comment", $edit["comment"] ? $edit["comment"] : $user->signature, 70, 10, filter_tips_short());
// preview button:
$form .= form_hidden("cid", $edit["cid"]);
diff --git a/modules/filter.module b/modules/filter.module
index d17e21df5..b812e6404 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -7,12 +7,32 @@ function filter_help($section = "admin/help#filter") {
return t("Framework for handling filtering of content.");
case 'admin/system/filters':
return t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions.");
+ case 'filter#tip':
+ switch (variable_get("filter_html", 1)) {
+ case 0:
+ return t("All HTML tags allowed");
+ break;
+ case 1:
+ if ($allowed_html = variable_get("allowed_html", "<a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul>")) {
+ return t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html);
+ } else {
+ return t("No HTML tags allowed");
+ }
+ break;
+ case 2:
+ return t("No HTML tags allowed");
+ break;
+ }
+ break;
}
}
function filter_link($type) {
- if ($type == "system" && user_access("administer site configuration")) {
- menu("admin/system/filters", t("filters"), "filter_admin", 5);
+ if ($type == "system") {
+ if (user_access("administer site configuration")) {
+ menu("admin/system/filters", t("filters"), "filter_admin", 5);
+ }
+ menu("filter/tips", t("Compose tips"), "filter_tips_page", 0, MENU_HIDE);
}
}
@@ -159,4 +179,19 @@ function filter_old_urls($text) {
return $text;
}
-?> \ No newline at end of file
+function filter_tips_page() {
+ $tips = module_invoke_all("help", "filter#tip");
+ foreach ($tips as $tip) {
+ if ($tip) {
+ $tiplist .= "<li>$tip</li>\n";
+ }
+ }
+ $output = "<ul class=\"compose-tips\">\n$tiplist\n</ul>\n";
+ print theme("page", $output, t("Compose Tips"));
+}
+
+function filter_tips_short() {
+ return filter_help("filter#tip") . "<br />" . l(t("More information on formatting options."), "filter/tips", array("target" => "_blank"));
+}
+
+?>
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index d17e21df5..b812e6404 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -7,12 +7,32 @@ function filter_help($section = "admin/help#filter") {
return t("Framework for handling filtering of content.");
case 'admin/system/filters':
return t("Filters fit between the raw text in a node and the HTML output. They allow you to replace text selectively. Uses include automatic conversion of emoticons into graphics and filtering HTML content from users' submissions.");
+ case 'filter#tip':
+ switch (variable_get("filter_html", 1)) {
+ case 0:
+ return t("All HTML tags allowed");
+ break;
+ case 1:
+ if ($allowed_html = variable_get("allowed_html", "<a> <b> <dd> <dl> <dt> <i> <li> <ol> <u> <ul>")) {
+ return t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html);
+ } else {
+ return t("No HTML tags allowed");
+ }
+ break;
+ case 2:
+ return t("No HTML tags allowed");
+ break;
+ }
+ break;
}
}
function filter_link($type) {
- if ($type == "system" && user_access("administer site configuration")) {
- menu("admin/system/filters", t("filters"), "filter_admin", 5);
+ if ($type == "system") {
+ if (user_access("administer site configuration")) {
+ menu("admin/system/filters", t("filters"), "filter_admin", 5);
+ }
+ menu("filter/tips", t("Compose tips"), "filter_tips_page", 0, MENU_HIDE);
}
}
@@ -159,4 +179,19 @@ function filter_old_urls($text) {
return $text;
}
-?> \ No newline at end of file
+function filter_tips_page() {
+ $tips = module_invoke_all("help", "filter#tip");
+ foreach ($tips as $tip) {
+ if ($tip) {
+ $tiplist .= "<li>$tip</li>\n";
+ }
+ }
+ $output = "<ul class=\"compose-tips\">\n$tiplist\n</ul>\n";
+ print theme("page", $output, t("Compose Tips"));
+}
+
+function filter_tips_short() {
+ return filter_help("filter#tip") . "<br />" . l(t("More information on formatting options."), "filter/tips", array("target" => "_blank"));
+}
+
+?>
diff --git a/modules/story.module b/modules/story.module
index 599842fa0..e19484aa6 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -83,7 +83,7 @@ function story_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("story", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}
diff --git a/modules/story/story.module b/modules/story/story.module
index 599842fa0..e19484aa6 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -83,7 +83,7 @@ function story_form(&$node, &$error) {
$output .= implode("", taxonomy_node_form("story", $node));
}
- $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
+ $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : filter_tips_short());
return $output;
}