1.12.7 i starsze - Automatyczne kodowanie linków by seba123
Seba123 - 08-05-2010, 02:41 Temat postu: Automatyczne kodowanie linków by seba123
Automatyczne kodowanie linków by seba123
Kodowanie wszystkich linków oraz instrukcja w BBCode CODE dla niezalogowanych
Kod: | #################################################################
## MOD Title: Automatyczne kodowanie linków by seba123
## MOD Version: 1.0
## MOD Author: Seba123
## MOD Description: Kodowanie wszystkich linków oraz instrukcja w BBCode CODE dla niezalogowanych.
##
## Installation Level: Medium
## Installation Time: 5 Minutes
## Files To Edit: (7)
## includes/bbcode.php
## includes/function_post.php
## search.php
## viewtopic.php
## printview.php
## includes/functions_add.php
## language/lang_polish/lang_main.php
##
################################################################# |
Co mod potrafi:
Automatyczne kodowanie linków (wsadzanie ich w tagi code),
Ukrywanie tagu code dla niezalogowanych.
pr0woKator - 10-05-2010, 18:46
Testował ktoś ?
Raczej nie mam wątpliwości co do moda, w końcu seby
[ Dodano: 10-05-2010, 18:46 ]
Ale wolę się upewnić
naXe - 10-05-2010, 20:18
Seba123 napisał/a: | Automatyczne kodowanie linków (wsadzanie ich w tagi code): |
działa.
Jak ktoś chce, aby link był ukryty to wystarczy zamienić:
Kod: | function code_links($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "[code]\\2[/code]", $ret);
return($ret);
} |
na:
Kod: | function hide_links($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[hide]\\2[/hide]", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[hide]\\2[/hide]", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "[hide]\\2[/hide]", $ret);
return($ret);
} |
oraz:
Kod: | $message = code_links($message); |
na:
Kod: | $message = hide_links($message); |
HardROoZi - 15-05-2010, 15:39
mozna ten mod zedytowac zeby zamiast w CODE wsadzalo w tag QUOTE ? bo bym chcial zeby linki byly klikane
[ Dodano: 15-05-2010, 16:07 ]
dobra poradziłem sobie
naXe - 15-05-2010, 16:57
HardROoZi,
Kod: | function code_links($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "[code]\\2[/code]", $ret);
return($ret);
} |
zamień na:
Kod: | function quote_links($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[quote]\\2[/quote]", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[quote]\\2[/quote]", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "[quote]\\2[/quote]", $ret);
return($ret);
} |
oraz:
Kod: | $message = code_links($message); |
zamień na:
Kod: | $message = quote_links($message); |
HardROoZi - 16-05-2010, 18:54
co zrobic zeby po edycji nie kolonowało sie ciagle to kodowanie ? bo sie robi takie cos :
i jak sie edytuje to za kazdym razem sie dodaje tag
Seba123 - 16-05-2010, 21:42
HardROoZi, u mnie taki problem nie występuje.
HardROoZi - 16-05-2010, 21:51
Seba123, to obadaj u mnie test / test link w profilu. napisz posta z linkiem potem go edytuj i zobaczysz
uprzedzam ze dodalem tylko "Automatyczne kodowanie linków" bo ukrywanie mi nie potrzebne
Seba123 - 16-05-2010, 23:05
Tylko Ty masz quote, a ja supportuje moda dla code.
HardROoZi - 16-05-2010, 23:07
Seba123, a dałoby rade dodać zeby w CODE byly klikane linki ?
JustDoIt! - 20-06-2010, 21:46
działą to z beer modem ?
sebul00000 - 09-08-2010, 12:24
A co zrobić, żeby ukryć dla niezalogowanych tag code w widoku taga tematu w chmurze tagów?
wisza64 - 24-09-2010, 17:10
U mnie niestety samo nie koduje zobaczcie: http://www.mods-ls.com.pl...t8961.htm#28498 Wgrałem tak jak w instrukcji.
evilmc - 26-09-2010, 23:59
can someone translate in English, follow instructions?
Boltex - 27-09-2010, 00:15
evilmc, of course.
As a long time I did not give anything, the fast-acting encoding you gripped all the links and instructions on how to hide the code for not logged in BBCode.
Automatic coding of links
1. open file includes/bbcode.php, find Kod: | function make_clickable($text) | before add Kod: | function code_links($text)
{
$text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.\S[\w\#()$%&~/.\-;:=,?@\[\]+]*)#is", "[code]\\2[/code]", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "[code]\\2[/code]", $ret);
return($ret);
} |
2. open file includes/function_post.php, find Kod: | // Check message
if (!empty($message)) | before add Kod: | $message = code_links($message); |
Hiding code tag for not logged in:
1. open file search.php, find Kod: | if ( $bbcode_uid != '' ) | after add Kod: | if ( $userdata['user_id'] == ANONYMOUS )
{
$code_no_guest_text = $lang['Code_No_Guests'];
$message = preg_replace("#\[code(.*?)\](.*?)\[/code.(.*?)\]#si", '[code\\1]' . $code_no_guest_text . '[/code:\\3]', $message);
} |
2. open file viewtopic.php,find Kod: | $message = $postrow[$i]['post_text']; | after add Kod: | if ( $userdata['user_id'] == ANONYMOUS )
{
$code_no_guest_text = $lang['Code_No_Guests'];
$message = preg_replace("#\[code(.*?)\](.*?)\[/code.(.*?)\]#si", '[code\\1]' . $code_no_guest_text . '[/code:\\3]', $message);
} |
3. open file printview.php, find Kod: | $message = $postrow[$i]['post_text']; | after add Kod: | if ( $userdata['user_id'] == ANONYMOUS )
{
$code_no_guest_text = $lang['Code_No_Guests'];
$message = preg_replace("#\[code(.*?)\](.*?)\[/code.(.*?)\]#si", '[code\\1]' . $code_no_guest_text . '[/code:\\3]', $message);
} |
4. open file includes/functions_add.php, find Kod: | global $first_and_last_post, $count_orig_word, $orig_word, $replacement_word; | replace it on Kod: | global $first_and_last_post, $count_orig_word, $orig_word, $userdata; | find Kod: | $overlib_post_text = preg_replace("#\[url(.*?)\](.*?)\[\/url\]#si", "\\2", $overlib_post_text); | after add Kod: | $overlib_post_text = ( $userdata['user_id'] == ANONYMOUS ) ? preg_replace("#\[code(.*?)\](.*?)\[/code.(.*?)\]#si", "[ CODE ]", $overlib_post_text) : $overlib_post_text; |
5. open file language/lang_english/lang_main.php, find Kod: | // ------------------------------------------------- | after add
Kod: | $lang['Code_No_Guests'] = 'To be able to view the content placed, in the tag [ code ] you need to register'; |
Of course you can change the text on lang_main.php
|
|
|