1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Bugfix: internal link detection was failing. Also added support for [link=url rel=internal] for overriding default preference.

This commit is contained in:
CaMer0n
2007-11-13 07:38:55 +00:00
parent f2f48f657b
commit 851f8cc320
3 changed files with 26 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ global $pref;
[link=external=http://mysite.com]My text[/link]
*/
$parm = trim($parm);
/* Fix for people using link=external= */
@@ -38,8 +39,14 @@ global $pref;
$extras = "rel=external";
}
$insert = (($pref['links_new_window'] || $extras == "external" || strpos($extras,"rel=external")!==FALSE) && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#") ? "rel='external' " : "";
if($extras == "external" || strpos($extras,"rel=external")!==FALSE)
{
$insert = "rel='external' ";
}
else
{
$insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : "";
}
if (strtolower(substr($link,0,11)) == 'javascript:') return '';
return "<a class='bbcode' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $
| $Revision: 1.12 $
| $Date: 2007-11-13 07:34:40 $
| $Revision: 1.13 $
| $Date: 2007-11-13 07:38:55 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -66,6 +66,7 @@ class e_bbcode
global $postID;
$postID = $p_ID;
if (strlen($value) <= 6) return $value; // Don't waste time on trivia!
if ($force_lower == 'default') $force_lower = TRUE; // Set the default behaviour if not overridden
$code_stack = array(); // Stack for unprocessed bbcodes and text
@@ -254,7 +255,8 @@ class e_bbcode
{
global $tp, $postID, $code_text, $parm;
$parm = $param1;
$code_text = $tp->replaceConstants($code_text_par);
$code_text = $code_text_par;
if (E107_DEBUG_LEVEL)
{

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
| $Revision: 1.21 $
| $Date: 2007-11-10 19:24:42 $
| $Author: mcfly_e107 $
| $Revision: 1.22 $
| $Date: 2007-11-13 07:38:55 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@@ -475,11 +475,7 @@ class e_parse
}
// replace all {e_XXX} constants with their e107 value
if ($opts['constants'])
{
$text = $this->replaceConstants($text);
}
if ($opts['no_tags'])
{
@@ -562,6 +558,8 @@ class e_parse
}
// Start parse [bb][/bb] codes
if ($parseBB === TRUE)
{
@@ -574,6 +572,12 @@ class e_parse
// End parse [bb][/bb] codes
// replace all {e_XXX} constants with their e107 value AFTER the bbcodes have been parsed.
if ($opts['constants'])
{
$text = $this->replaceConstants($text);
}
// profanity filter
if ($pref['profanity_filter']) {
if (!is_object($this->e_pf)) {