th23 Autolinks Mod Problem

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
blossom10
Mitglied
Beiträge: 257
Registriert: 20.06.2009 03:36
Kontaktdaten:

th23 Autolinks Mod Problem

Beitrag von blossom10 »

Hallo zusammen,

Da dieser Mod ( th Autolinks )scheinbar vom Autor nicht mehr Supportet wird Frage in die Runde der Programmierer....

Diese Mod funktioniert wunderbar wenn man im Text bestimmte Wörter hat die dann automatisch an einem Link gebunden werden und im Beitrag auch als Verlinkung ausgegeben werden.

Nun hätte ich aber auch gerne das nicht nur ein Wort sondern auch wenn ich das wort selbst als link schreibe oder den benutze es auf meinen definierten link umgewandelt wird.

Beispiel:

Wort "Suppe" wird im Text zu http://www. suppeneintopf.com umgewandelt und als link geschrieben. Wenn jetzt ein User aber http://www. suppe.com schreibt wird er nicht umgewandelt, ich hätte gerne das auch dann wenn das wort "Suppe" drinn vorkommt umgewandelt wird.

Suppe - Link ist dann http://www.suppeneintopf.com
www. suppe.com - Link ist dann http:// www.suppeneintopf.com
suppentopf - link ist dann http://www.suppeneintopf.com

Also was ich erreichen will ist das egal wie jemand dieses Wort schreibt die Ausgabe immer über mein vordefinierten link geht.

Hoffe das war verständlich
Danke
Gruss blossom10
----------------------------------------------
Casino Forum / Novoline Slots Forum
Benutzeravatar
Miriam
Mitglied
Beiträge: 12310
Registriert: 13.10.2004 07:18
Kontaktdaten:

Re: th23 Autolinks Mod Problem

Beitrag von Miriam »

Dann solltest du evtl. die Wortzensur anstrengen, um zum (teilweisen) Erfolg zu kommen.
Gruss, Miriam.
Ich schmeiß' alles hin und...
... lasse es liegen
blossom10
Mitglied
Beiträge: 257
Registriert: 20.06.2009 03:36
Kontaktdaten:

Re: th23 Autolinks Mod Problem

Beitrag von blossom10 »

Danke,

die Idee hatte ich auch schon, löst aber nicht das Problem. Teilerfolg auch eher weniger.
Gruss blossom10
----------------------------------------------
Casino Forum / Novoline Slots Forum
Benutzeravatar
Miriam
Mitglied
Beiträge: 12310
Registriert: 13.10.2004 07:18
Kontaktdaten:

Re: th23 Autolinks Mod Problem

Beitrag von Miriam »

Irgendwie sehe ich kein Ende bei den Worten, die zum Suppeneintopf führen sollen:
  • Suppe,
  • suppe.com,
  • Suppentopf
Was ist mit:
  • Suppenloeffel,
  • Suppenlöffel,
  • Suppengemüse,
  • Eintopfsuppe,
  • Meerschweinchen
zzgl. evtl. Schreibfehler in diesen Begriffen?
Gruss, Miriam.
Ich schmeiß' alles hin und...
... lasse es liegen
blossom10
Mitglied
Beiträge: 257
Registriert: 20.06.2009 03:36
Kontaktdaten:

Re: th23 Autolinks Mod Problem

Beitrag von blossom10 »

Hallo,

habe es mal getestet und Wörter die tatsächlich zusammenhängen wie Suppeneintopf, Suppenschüssel schreibt der Mod nicht automatisch um nur einzel Wörter die dann wären Suppen-Eintopf, Suppen-Schüssel in diesem Fall erkennt er das Wort Suppe und schreibt es dann in den Link um.

Worauf ich ja hinaus will ist das wenn jemand jetzt im Beitrag selbst eine URL benutzt wie http:// www .suppen-schüssel.com oder es direkt in den URL code setzt ..... der Mod auch dort das Wort Suppe erkennt und es in den vorgegeben Link von mir umsetzt.
Hier mal die autolinks.php in dem wohl die Links umgeschrieben werden. Den url code hatte ich unten mal eingefügt hatte auch den Effekt das er den Link umgesetzt hat, er dann aber im Beitrag aus dem Code eine ganze html Zeile geschrieben hatte.

Code: Alles auswählen

<?php
/*
*
* includes/th23_autolinks.php
*
* @package th23_autolinks
* @author Thorsten Hartmann (www.th23.net)
* @copyright (c) 2008 by Thorsten Hartmann (www.th23.net)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

if(!defined('IN_PHPBB'))
{
	exit;
}

// obtain th23_autolinks (if possible from cache)
if (!isset($th23_autolinks) || !is_array($th23_autolinks))
{
	$th23_autolinks = $cache->obtain_th23_autolinks();
}

// setup autolinks css/title
$th23_autolinks_css = ($config['th23_autolinks_css']) ? ' class="' . $config['th23_autolinks_css'] . '"' : '';
$th23_autolinks_title = ($config['th23_autolinks_title']) ? ' title="' . $config['th23_autolinks_title'] . '"' : '';

// prepare root path and session id for local links
$th23_autolinks_local = array(
	'search' => array(
		'th23autolink_root', 
		'th23autolink_sid_and', 
		'th23autolink_sid_que',
	),
	'replace' => array(
		$phpbb_root_path,
		(!empty($_SID)) ? '&sid=' . $_SID : '',
		(!empty($_SID)) ? '?sid=' . $_SID : '',
	),
);

// ensure global availability of bbcode_uid for replacement callbacks
$th23_autolinks_uid = '';

// replace text with links in specified text
function th23_autolinks($text, $bbcode_uid)
{
	global $th23_autolinks, $th23_autolinks_uid, $user, $config;

	$th23_autolinks_uid = $bbcode_uid;

	// convert standard bbcodes tags to secure them from being linked
	$search = array(
		'[i:' . $th23_autolinks_uid . ']', 
		'[/i:' . $th23_autolinks_uid . ']',
		'[u:' . $th23_autolinks_uid . ']', 
		'[/u:' . $th23_autolinks_uid . ']', 
		'[b:' . $th23_autolinks_uid . ']', 
		'[/b:' . $th23_autolinks_uid . ']', 
		'[*:' . $th23_autolinks_uid . ']', 
		'[/*:m:' . $th23_autolinks_uid . ']', 
		'[/quote:' . $th23_autolinks_uid . ']', 
		'[/list:o:' . $th23_autolinks_uid . ']', 
		'[/list:u:' . $th23_autolinks_uid . ']', 
		'[/color' . $th23_autolinks_uid . ']', 
		'[/size' . $th23_autolinks_uid . ']', 
	);
	$replace = array(
		' th23autolink_bbcode_start_i_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_i_' . $th23_autolinks_uid . ' ',
		' th23autolink_bbcode_start_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_start_b_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_b_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_start_star_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_star_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_quote_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_list_o_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_list_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_color_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_size_' . $th23_autolinks_uid . ' ', 
	);
	if ($config['th23_autolinks_code'])
	{
		$search[] = '[code:' . $th23_autolinks_uid . ']'; 
		$search[] = '[/code:' . $th23_autolinks_uid . ']'; 
		$replace[] = ' th23autolink_bbcode_start_code_' . $th23_autolinks_uid . ' '; 
		$replace[] = ' th23autolink_bbcode_end_code_' . $th23_autolinks_uid . ' '; 
      
	}
	$text = str_replace($search, $replace, $text);
		
	// encode img, url, flash, attachment, smilies (incl. start/end tag)
	// and encode start tag of quote, list, color, size
	$search = array(
		'/\[url.*?:' . $th23_autolinks_uid . '\].*?\[\/url:' . $th23_autolinks_uid . '\]/i',
      '/\[img:' . $th23_autolinks_uid . '\].*?\[\/img:' . $th23_autolinks_uid . '\]/i',
      '/\[img_l:' . $th23_autolinks_uid . '\].*?\[\/img_l:' . $th23_autolinks_uid . '\]/i',
      '/\[img_r:' . $th23_autolinks_uid . '\].*?\[\/img_r:' . $th23_autolinks_uid . '\]/i',
		'/\[flash.*?:' . $th23_autolinks_uid . '\].*?\[\/flash:' . $th23_autolinks_uid . '\]/i',
		'/\[attachment.*?:' . $th23_autolinks_uid . '\].*?\[\/attachment:' . $th23_autolinks_uid . '\]/i',
		'/(<!-- s:.*?: -->)<img.*?\/>\1/i', 
		'/(<!-- m -->).*?\1/i',
		'/(<!-- l -->).*?\1/i',
		'/(<!-- w -->).*?\1/i',
		'/(<!-- e -->).*?\1/i',
		'/\[quote.*?:' . $th23_autolinks_uid . '\]/i',
		'/\[list.*?:' . $th23_autolinks_uid . '\]/i',
		'/\[color.*?:' . $th23_autolinks_uid . '\]/i',
		'/\[size.*?:' . $th23_autolinks_uid . '\]/i',
	);
	// optionally encode code (incl. start/end tag)
	if (!$config['th23_autolinks_code'])
	{
		$search[] = '/\[code:' . $th23_autolinks_uid . '\].*?\[\/code:' . $th23_autolinks_uid . '\]/i';
	}
	$text = preg_replace_callback($search, 'th23_autolinks_encode', $text);

	// find specified words in posts and replace it by an encoded link
	$text = preg_replace_callback($th23_autolinks['pattern'], 'th23_autolinks_encode_links', $text);

	// decode the encoded part
	$text = preg_replace_callback('/\sth23autolink_encode_start_' . $th23_autolinks_uid . '(.*?)th23autolink_encode_end_' . $th23_autolinks_uid . '\s/i', 'th23_autolinks_decode', $text);

$link = preg_replace_callback($search, 'th23_autolinks_encode', $link);

	// find specified words in posts and replace it by an encoded link
	$link = preg_replace_callback($th23_autolinks['pattern'], 'th23_autolinks_encode_links', $link);

	// decode the encoded part
	$link = preg_replace_callback('/\sth23autolink_encode_start_' . $th23_autolinks_uid . '(.*?)th23autolink_encode_end_' . $th23_autolinks_uid . '\s/i', 'th23_autolinks_decode', $link);

	// re-convert standard bbcodes tags
	$search = array(
		' th23autolink_bbcode_start_i_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_i_' . $th23_autolinks_uid . ' ',
		' th23autolink_bbcode_start_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_start_b_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_b_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_start_star_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_star_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_quote_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_list_o_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_list_u_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_color_' . $th23_autolinks_uid . ' ', 
		' th23autolink_bbcode_end_size_' . $th23_autolinks_uid . ' ', 
	);
	$replace = array(
		'[i:' . $th23_autolinks_uid . ']', 
		'[/i:' . $th23_autolinks_uid . ']',
		'[u:' . $th23_autolinks_uid . ']', 
		'[/u:' . $th23_autolinks_uid . ']', 
		'[b:' . $th23_autolinks_uid . ']', 
		'[/b:' . $th23_autolinks_uid . ']', 
		'[*:' . $th23_autolinks_uid . ']', 
		'[/*:m:' . $th23_autolinks_uid . ']', 
		'[/quote:' . $th23_autolinks_uid . ']', 
		'[/list:o:' . $th23_autolinks_uid . ']', 
		'[/list:u:' . $th23_autolinks_uid . ']', 
		'[/color' . $th23_autolinks_uid . ']', 
		'[/size' . $th23_autolinks_uid . ']', 
	);
	if ($config['th23_autolinks_code'])
	{
		$search[] = ' th23autolink_bbcode_start_code_' . $th23_autolinks_uid . ' '; 
		$search[] = ' th23autolink_bbcode_end_code_' . $th23_autolinks_uid . ' '; 
		$replace[] = '[code:' . $th23_autolinks_uid . ']'; 
		$replace[] = '[/code:' . $th23_autolinks_uid . ']'; 
	}
	$text = str_replace($search, $replace, $text);

	return $text;
}

// encode smilies to avoid matching them against the search words
function th23_autolinks_encode($match)
{
	global $th23_autolinks_uid;
	return ' th23autolink_encode_start_' . $th23_autolinks_uid . base64_encode($match[0]) . 'th23autolink_encode_end_' . $th23_autolinks_uid . ' ';
}

// encode link to avoid matching this part against the next specified word
function th23_autolinks_encode_links($match)
{
	global $th23_autolinks, $th23_autolinks_css, $th23_autolinks_title, $th23_autolinks_local, $th23_autolinks_uid;
	return ' th23autolink_encode_start_' . $th23_autolinks_uid . base64_encode('<a href="' . str_replace($th23_autolinks_local['search'], $th23_autolinks_local['replace'], $th23_autolinks['replacement'][strtolower($match[1])]) . '"' . $th23_autolinks_css . $th23_autolinks_title . '>' . $match[1] . '</a>') . 'th23autolink_encode_end_' . $th23_autolinks_uid . ' ';
}

// decode the encoded links and smilies to display them properly
function th23_autolinks_decode($match)
{
	return base64_decode($match[1]);
}

?>
Gruss blossom10
----------------------------------------------
Casino Forum / Novoline Slots Forum
Antworten

Zurück zu „[3.0.x] Mod Support“