Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c3501960
Commit
c3501960
authored
Nov 20, 2001
by
Dries
Browse files
- added a "line" filter
parent
90e20726
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/node.module
View file @
c3501960
...
...
@@ -87,10 +87,46 @@ function node_filter_link($text) {
return
preg_replace
(
$src
,
$dst
,
$text
);
}
function
node_filter_line
(
$text
)
{
/*
** If HTML mark-up is being used, strip regular mark-up:
*/
if
(
strstr
(
$text
,
"<br />"
)
||
strstr
(
$text
,
"<p>"
))
{
$text
=
ereg_replace
(
"[
\r\n\t\v
]"
,
""
,
$text
);
}
/*
** Replace '<br>', '<br />', '<p>' and '<p />' by '\n':
*/
$text
=
eregi_replace
(
"<br>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<p>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
/*
** Replace "\r\n" by "\n":
*/
$text
=
ereg_replace
(
"
\r\n
"
,
"
\n
"
,
$text
);
/*
** Replace some new line charachters:
*/
while
(
strpos
(
$text
,
"
\n\n\n
"
))
{
$text
=
ereg_replace
(
"
\n\n\n
"
,
"
\n\n
"
,
$text
);
}
return
trim
(
$text
);
}
function
node_filter
(
$text
)
{
if
(
variable_get
(
"filter_html"
,
0
))
$text
=
node_filter_html
(
$text
);
if
(
variable_get
(
"filter_link"
,
0
))
$text
=
node_filter_link
(
$text
);
return
trim
(
$text
);
return
node_filter_line
(
$text
);
}
function
node_link
(
$type
,
$node
=
0
)
{
...
...
modules/node/node.module
View file @
c3501960
...
...
@@ -87,10 +87,46 @@ function node_filter_link($text) {
return
preg_replace
(
$src
,
$dst
,
$text
);
}
function
node_filter_line
(
$text
)
{
/*
** If HTML mark-up is being used, strip regular mark-up:
*/
if
(
strstr
(
$text
,
"<br />"
)
||
strstr
(
$text
,
"<p>"
))
{
$text
=
ereg_replace
(
"[
\r\n\t\v
]"
,
""
,
$text
);
}
/*
** Replace '<br>', '<br />', '<p>' and '<p />' by '\n':
*/
$text
=
eregi_replace
(
"<br>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<p>"
,
"
\n
"
,
$text
);
$text
=
eregi_replace
(
"<br />"
,
"
\n
"
,
$text
);
/*
** Replace "\r\n" by "\n":
*/
$text
=
ereg_replace
(
"
\r\n
"
,
"
\n
"
,
$text
);
/*
** Replace some new line charachters:
*/
while
(
strpos
(
$text
,
"
\n\n\n
"
))
{
$text
=
ereg_replace
(
"
\n\n\n
"
,
"
\n\n
"
,
$text
);
}
return
trim
(
$text
);
}
function
node_filter
(
$text
)
{
if
(
variable_get
(
"filter_html"
,
0
))
$text
=
node_filter_html
(
$text
);
if
(
variable_get
(
"filter_link"
,
0
))
$text
=
node_filter_link
(
$text
);
return
trim
(
$text
);
return
node_filter_line
(
$text
);
}
function
node_link
(
$type
,
$node
=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment