summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/blog.module1
-rw-r--r--modules/blog/blog.module1
-rw-r--r--modules/book.module1
-rw-r--r--modules/book/book.module1
-rw-r--r--modules/comment.module6
-rw-r--r--modules/comment/comment.module6
-rw-r--r--modules/filter.module7
-rw-r--r--modules/filter/filter.module7
-rw-r--r--modules/forum.module1
-rw-r--r--modules/forum/forum.module1
-rw-r--r--modules/node.module20
-rw-r--r--modules/node/node.module20
-rw-r--r--modules/page.module1
-rw-r--r--modules/page/page.module1
-rw-r--r--modules/statistics.module10
-rw-r--r--modules/statistics/statistics.module10
-rw-r--r--modules/story.module1
-rw-r--r--modules/story/story.module1
18 files changed, 64 insertions, 32 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 103df2a53..ed50575c7 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -211,6 +211,7 @@ function blog_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
return $output;
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 103df2a53..ed50575c7 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -211,6 +211,7 @@ function blog_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
return $output;
}
diff --git a/modules/book.module b/modules/book.module
index 0d1b1e690..41c0ff843 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -212,6 +212,7 @@ function book_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
$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 0d1b1e690..41c0ff843 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -212,6 +212,7 @@ function book_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
$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 d50e34532..d4329c956 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1435,12 +1435,12 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t('Subject'), 'subject', $edit['subject'], 50, 64);
}
- // format selector
- $form .= filter_form('format', $edit['format']);
-
// comment field:
$form .= form_textarea(t('Comment'), 'comment', $edit['comment'] ? $edit['comment'] : $user->signature, 70, 10, '', NULL, TRUE);
+ // format selector
+ $form .= filter_form('format', $edit['format']);
+
// preview button:
$form .= form_hidden('cid', $edit['cid']);
$form .= form_hidden('pid', $edit['pid']);
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index d50e34532..d4329c956 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1435,12 +1435,12 @@ function theme_comment_form($edit, $title) {
$form .= form_textfield(t('Subject'), 'subject', $edit['subject'], 50, 64);
}
- // format selector
- $form .= filter_form('format', $edit['format']);
-
// comment field:
$form .= form_textarea(t('Comment'), 'comment', $edit['comment'] ? $edit['comment'] : $user->signature, 70, 10, '', NULL, TRUE);
+ // format selector
+ $form .= filter_form('format', $edit['format']);
+
// preview button:
$form .= form_hidden('cid', $edit['cid']);
$form .= form_hidden('pid', $edit['pid']);
diff --git a/modules/filter.module b/modules/filter.module
index 26eeac602..770911c87 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -6,6 +6,9 @@
* Framework for handling filtering of content.
*/
+// This is a special format ID which means "use the default format". This value
+// can be passed to the filter APIs as a format ID: this is equivalent to not
+// passing an explicit format at all.
define('FILTER_FORMAT_DEFAULT', 0);
define('FILTER_HTML_STRIP', 1);
@@ -619,7 +622,7 @@ function check_output($text, $format = FILTER_FORMAT_DEFAULT) {
* @return
* HTML for the form element.
*/
-function filter_form($name, $value = FILTER_FORMAT_DEFAULT) {
+function filter_form($name = 'format', $value = FILTER_FORMAT_DEFAULT) {
if ($value == FILTER_FORMAT_DEFAULT) {
$value = variable_get('filter_default_format', 1);
}
@@ -655,7 +658,7 @@ function filter_form($name, $value = FILTER_FORMAT_DEFAULT) {
* Returns true if the user is allowed to access this format.
*/
function filter_access($format) {
- if (user_access('administer filters') || ($format == variable_get('filter_default_format', 1))) {
+ if (user_access('administer filters') || ($format == FILTER_FORMAT_DEFAULT) || ($format == variable_get('filter_default_format', 1))) {
return true;
}
else {
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 26eeac602..770911c87 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -6,6 +6,9 @@
* Framework for handling filtering of content.
*/
+// This is a special format ID which means "use the default format". This value
+// can be passed to the filter APIs as a format ID: this is equivalent to not
+// passing an explicit format at all.
define('FILTER_FORMAT_DEFAULT', 0);
define('FILTER_HTML_STRIP', 1);
@@ -619,7 +622,7 @@ function check_output($text, $format = FILTER_FORMAT_DEFAULT) {
* @return
* HTML for the form element.
*/
-function filter_form($name, $value = FILTER_FORMAT_DEFAULT) {
+function filter_form($name = 'format', $value = FILTER_FORMAT_DEFAULT) {
if ($value == FILTER_FORMAT_DEFAULT) {
$value = variable_get('filter_default_format', 1);
}
@@ -655,7 +658,7 @@ function filter_form($name, $value = FILTER_FORMAT_DEFAULT) {
* Returns true if the user is allowed to access this format.
*/
function filter_access($format) {
- if (user_access('administer filters') || ($format == variable_get('filter_default_format', 1))) {
+ if (user_access('administer filters') || ($format == FILTER_FORMAT_DEFAULT) || ($format == variable_get('filter_default_format', 1))) {
return true;
}
else {
diff --git a/modules/forum.module b/modules/forum.module
index 744469dd8..f9330bd56 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -293,6 +293,7 @@ function forum_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '');
+ $output .= filter_form('format', $node->format);
return $output;
}
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 744469dd8..f9330bd56 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -293,6 +293,7 @@ function forum_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '');
+ $output .= filter_form('format', $node->format);
return $output;
}
diff --git a/modules/node.module b/modules/node.module
index 6e3c4f905..c3812f963 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1009,7 +1009,16 @@ function node_feed($nodes = 0, $channel = array()) {
// Load the specified node:
$item = node_load(array('nid' => $node->nid));
$link = url("node/$node->nid", NULL, NULL, 1);
- $items .= format_rss_item($item->title, $link, check_output($item->teaser ? $item->teaser : $item->body, $item->format), array('pubDate' => date('r', $item->changed)));
+
+ // Filter and prepare node teaser
+ if (node_hook($item, 'view')) {
+ node_invoke($item, 'view', TRUE, FALSE);
+ }
+ else {
+ $item = node_prepare($item, TRUE);
+ }
+
+ $items .= format_rss_item($item->title, $link, $item->teaser, array('pubDate' => date('r', $item->changed)));
}
$channel_defaults = array(
@@ -1148,7 +1157,6 @@ function node_form($edit) {
$output .= '<input type="hidden" name="op" value="'. check_form(t('Preview')) ."\" />\n";
// Add the admin-specific parts.
-
if (user_access('administer nodes')) {
$output .= '<div class="admin">';
@@ -1174,20 +1182,13 @@ function node_form($edit) {
}
// Add the default fields.
-
$output .= '<div class="standard">';
$output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE);
- // Add filter format selector / filter tips
-
- $output .= filter_form('format', $edit->format);
-
// Add the node-type-specific fields.
-
$output .= $form;
// Add the hidden fields.
-
if ($edit->nid) {
$output .= form_hidden('nid', $edit->nid);
}
@@ -1205,7 +1206,6 @@ function node_form($edit) {
$output .= form_hidden('type', $edit->type);
// Add the buttons.
-
$output .= form_submit(t('Preview'));
if (!form_get_errors()) {
diff --git a/modules/node/node.module b/modules/node/node.module
index 6e3c4f905..c3812f963 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1009,7 +1009,16 @@ function node_feed($nodes = 0, $channel = array()) {
// Load the specified node:
$item = node_load(array('nid' => $node->nid));
$link = url("node/$node->nid", NULL, NULL, 1);
- $items .= format_rss_item($item->title, $link, check_output($item->teaser ? $item->teaser : $item->body, $item->format), array('pubDate' => date('r', $item->changed)));
+
+ // Filter and prepare node teaser
+ if (node_hook($item, 'view')) {
+ node_invoke($item, 'view', TRUE, FALSE);
+ }
+ else {
+ $item = node_prepare($item, TRUE);
+ }
+
+ $items .= format_rss_item($item->title, $link, $item->teaser, array('pubDate' => date('r', $item->changed)));
}
$channel_defaults = array(
@@ -1148,7 +1157,6 @@ function node_form($edit) {
$output .= '<input type="hidden" name="op" value="'. check_form(t('Preview')) ."\" />\n";
// Add the admin-specific parts.
-
if (user_access('administer nodes')) {
$output .= '<div class="admin">';
@@ -1174,20 +1182,13 @@ function node_form($edit) {
}
// Add the default fields.
-
$output .= '<div class="standard">';
$output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE);
- // Add filter format selector / filter tips
-
- $output .= filter_form('format', $edit->format);
-
// Add the node-type-specific fields.
-
$output .= $form;
// Add the hidden fields.
-
if ($edit->nid) {
$output .= form_hidden('nid', $edit->nid);
}
@@ -1205,7 +1206,6 @@ function node_form($edit) {
$output .= form_hidden('type', $edit->type);
// Add the buttons.
-
$output .= form_submit(t('Preview'));
if (!form_get_errors()) {
diff --git a/modules/page.module b/modules/page.module
index a73da4679..9c51a2ffc 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -123,6 +123,7 @@ function page_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
$output .= form_textfield(t('Link name'), 'link', $node->link, 60, 64, t('To make the page show up in the navigation links, enter the name of the link. Otherwise, leave this blank.'));
$output .= form_textfield(t('Link description'), 'description', $node->description, 60, 64, t("The description displayed when hovering over the page's link. Leave blank when you don't want a description."));
diff --git a/modules/page/page.module b/modules/page/page.module
index a73da4679..9c51a2ffc 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -123,6 +123,7 @@ function page_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
$output .= form_textfield(t('Link name'), 'link', $node->link, 60, 64, t('To make the page show up in the navigation links, enter the name of the link. Otherwise, leave this blank.'));
$output .= form_textfield(t('Link description'), 'description', $node->description, 60, 64, t("The description displayed when hovering over the page's link. Leave blank when you don't want a description."));
diff --git a/modules/statistics.module b/modules/statistics.module
index 5ada47b1b..e31b9a5ba 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -626,8 +626,16 @@ function statistics_summary($dbfield, $dbrows) {
$content = node_load(array('nid' => $nid['nid']));
$links = link_node($content, 1);
+ // Filter and prepare node teaser
+ if (node_hook($content, 'view')) {
+ node_invoke($content, 'view', TRUE, FALSE);
+ }
+ else {
+ $content = node_prepare($content, TRUE);
+ }
+
$output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>';
- $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. check_output($content->teaser, $content->format) .'</div></td></tr>';
+ $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>';
$output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>';
}
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 5ada47b1b..e31b9a5ba 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -626,8 +626,16 @@ function statistics_summary($dbfield, $dbrows) {
$content = node_load(array('nid' => $nid['nid']));
$links = link_node($content, 1);
+ // Filter and prepare node teaser
+ if (node_hook($content, 'view')) {
+ node_invoke($content, 'view', TRUE, FALSE);
+ }
+ else {
+ $content = node_prepare($content, TRUE);
+ }
+
$output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>';
- $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. check_output($content->teaser, $content->format) .'</div></td></tr>';
+ $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>';
$output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>';
}
diff --git a/modules/story.module b/modules/story.module
index 7c8cb4dda..0448c9d2d 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -123,6 +123,7 @@ function story_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
return $output;
}
diff --git a/modules/story/story.module b/modules/story/story.module
index 7c8cb4dda..0448c9d2d 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -123,6 +123,7 @@ function story_form(&$node) {
}
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
+ $output .= filter_form('format', $node->format);
return $output;
}