vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Show Thread Enhancements - Post Replacements (https://vborg.vbsupport.ru/showthread.php?t=125307)

DrewM 08-29-2006 10:00 PM

Post Replacements
 
Post Replacements 1.8

About
This hack allows you to have replacements for posts, for example you say you wanted every word that says vbulletin to say vbulletin.com you just have to put that in the option in vbulletin settings.

Important
When putting your replacements in the option read the description first to understand how it works.

Change Log
1.1; Fixed the plugin thanks Stoebi
1.5; Replacements now don't interfere with words that include the replacement. Thanks again to Stoebi :) .

A big thanks to Stoebi for providing most of the code!

Stromba 08-30-2006 11:34 AM

:) Wooooow nice, first reply and first install..

DrewM 08-30-2006 11:37 AM

thanks, enjoy

C_P 08-30-2006 12:33 PM

This seems like a nice addition. I am a bit confused though.
1. When I add this lets say vB do I need to add the http://www.vbulletin.com so it shows vB===http://www.vbulletin.com as a hyperlink like this vB?
2. If I wanted to have this hyperlink a different color, would this also be possible? Example: like this: vB

DrewM 08-30-2006 01:33 PM

C_P, to your questions:
1. no, to get that you must put:
vB===<a href="http://www.vbulletin.com">vB</a>, the option parsed the text I have to find a way to bypass that.
2.yes that is possible just put the HTML for the diffrent color arount the link code.

teneffus 08-30-2006 01:38 PM

screenshot pls?

C_P 08-30-2006 02:23 PM

ok, I may be doing something wrong here but this is enabled and am trying the following code replacements with no sucess:
Code:

vB===<a href="<A href="http://www.vbulletin.com"><font">http://www.vbulletin.com"><font color="#008000">vB</font></a>|||Computer Paradise===<a href="<A href="http://www.cpfools.com"><font">http://www.cpfools.com"><font color="#008000">Computer Paradise</font></a>|||rules===<a href="<A href="http://www.cpfools.com/index.php?option=com_content&task=view&id=5&Itemid=6"><font">http://www.cpfools.com/index.php?option=com_content&task=view&id=5&Itemid=6"><font color="#008000">rules</font></a>|||tutorial===<a href="<A href="http://www.cpfools.com/tutorials/"><font">http://www.cpfools.com/tutorials/"><font color="#008000">tutorial</font></a>
See here:
http://www.cpfools.com/forum/showthr...5111#post15111

Nachtfalke 08-30-2006 02:53 PM

Quote:

Originally Posted by C_P
ok, I may be doing something wrong here

Didn't test the mod yet, but you have way to much html in the replacement. Perhaps try

PHP Code:

vB===<a href="http://www.vbulletin.com"><font color="#008000">vB</font></a>|||Computer Paradise===<a href="http://www.cpfools.com"><font color="#008000">Computer Paradise</font></a>|||rules===<A href="http://www.cpfools.com/index.php?option=com_content&task=view&id=5&Itemid=6"><font color="#008000">rules</font></a>|||tutorial===<a href="http://www.cpfools.com/tutorials/"><font color="#008000">tutorial</font></a

or better: give the replacement tags a class (maybe with the name replacement) and define them via css:

PHP Code:

vB===<a href="http://www.vbulletin.com" class="replacment">vB</a>|||Computer Paradise===<a href="http://www.cpfools.com"  class="replacment">Computer Paradise</a>|||rules===<A href="http://www.cpfools.com/index.php?option=com_content&task=view&id=5&Itemid=6"  class="replacment">rules</a>|||tutorial===<a href="http://www.cpfools.com/tutorials/"  class="replacment">tutorial</a

then add the following to your css:
Code:

.replacement {
 color: #008000
}


C_P 08-30-2006 03:13 PM

Thank you much for the code suggestions but after copying and pasting both codes you supplied, neither work.
This one may be going bye bye. Sorry bud but if this cannot be easily done, not sure it is worth it.
Thanks anyway, good idea.

DrewM 08-30-2006 03:54 PM

I think this is casued by the way vb reads links sorry this doesn't work for you.

DrewM 08-30-2006 03:57 PM

Quote:

Originally Posted by teneffus
screenshot pls?

screens aren't reall needed are they?

voteforbird 08-30-2006 05:08 PM

This add-on doesn't work for me…

DrewM 08-30-2006 05:11 PM

Quote:

Originally Posted by voteforbird
This add-on doesn't work for me…

why?

outlaw621 08-30-2006 05:55 PM

This is not working for me either. No matter what I enter it will not parse the replacement value. I have tried setting enable to yes and to no (just incase). I checked to make sure that the replacement product and plugin were both active. I have tried the following formats:

For a single entry I have tried:
Code:

test===change text
For multiple entries I have tried:
Code:

test===change text ||| test2===change text2
I have even tried using ||| without a space between entries:
Code:

test===change text|||test2===change text2
None of the above variations work.

DrewM 08-30-2006 06:16 PM

Quote:

Originally Posted by outlaw621
This is not working for me either. No matter what I enter it will not parse the replacement value. I have tried setting enable to yes and to no (just incase). I checked to make sure that the replacement product and plugin were both active. I have tried the following formats:

For a single entry I have tried:
Code:

test===change text
For multiple entries I have tried:
Code:

test===change text ||| test2===change text2
I have even tried using ||| without a space between entries:
Code:

test===change text|||test2===change text2
None of the above variations work.

I have tried all of these and they work fine. What products do you have installed?

outlaw621 08-30-2006 06:37 PM

None. I have tried the above on a clean install (test board).

Ntfu2 08-30-2006 06:59 PM

Im sure there is a difference, but whats the difference between this and using vBulletins built in replacement variables?

voteforbird 08-30-2006 07:14 PM

Quote:

Originally Posted by Larrysw
why?

Uh? I was hoping you could tell me? :rolleyes:

asj 08-30-2006 08:13 PM

thanks

DrewM 08-30-2006 08:21 PM

Quote:

Originally Posted by outlaw621
None. I have tried the above on a clean install (test board).

couldn't tell you then all I can say is try re-installing the product.
Quote:

Im sure there is a difference, but whats the difference between this and using vBulletins built in replacement variables?
vBulletins built in replacement you put the tags and stuff this uses str_replace() so any words can be replaced.
Quote:

Uh… I was hoping you could tell me?
all it is a vboption and then a post with some bbcode.

Snatch 08-31-2006 05:52 AM

Here the Same, it doesen´t works.

GreeTz
Snatch

Stoebi 08-31-2006 06:22 AM

Hi,

replace $vbulletin with $this->registry in the plugin Replacments (Hook postbit_display_complete) (2 times).

Code:

//$post[message]
if ($this->registry->options['post_replacements_enabled'] == '1') {
        $replacments_array_mine = explode("|||", $this->registry->options['post_Replacements_option']);
        foreach ($replacments_array_mine as $post_replace) {
                $post_explode_rple = explode("===", $post_replace);
                $post['message'] = str_replace($post_explode_rple['0'], $post_explode_rple['1'], $post['message']);
        }
}

It works fantastic. I've clicked install. :)



Kind Regards,

Stoebi

Nachtfalke 08-31-2006 08:15 AM

Now that are good news, Stoebi! So I will try this one out

DrewM 08-31-2006 09:17 AM

Quote:

Originally Posted by Stoebi
Hi,

replace $vbulletin with $this->registry in the plugin Replacments (Hook postbit_display_complete) (2 times).

Code:

//$post[message]
if ($this->registry->options['post_replacements_enabled'] == '1') {
        $replacments_array_mine = explode("|||", $this->registry->options['post_Replacements_option']);
        foreach ($replacments_array_mine as $post_replace) {
                $post_explode_rple = explode("===", $post_replace);
                $post['message'] = str_replace($post_explode_rple['0'], $post_explode_rple['1'], $post['message']);
        }
}

It works fantastic. I've clicked install. :)



Kind Regards,

Stoebi

thank you will upade the hack.

C_P 08-31-2006 02:42 PM

NOW it works!
I used the following code and works perfectly:
Code:

vB===<a href="http://www.vbulletin.com"><font color="#008000">vB</font></a>|||Computer Paradise===<a href="http://www.cpfools.com"><font color="#008000">Computer Paradise</font></a>|||rules===<A href="http://www.cpfools.com/index.php?option=com_content&task=view&id=5&Itemid=6"><font color="#008000">rules</font></a>|||tutorial===<a href="http://www.cpfools.com/tutorials/"><font color="#008000">tutorial</font></a

See here:
http://www.cpfools.com/forum/showthread.php?t=5901
Clicked install!
Thank you!

outlaw621 08-31-2006 03:53 PM

Working now with the updated code. Thank you. I have a feature request if possible. Can you make the text replacement case insensitive? For example, typing test or Test would be able to have the replacement text applied instead of having to setup several of the same replacements to compensate for case.

C_P 08-31-2006 04:02 PM

Quote:

Originally Posted by outlaw621
Working now with the updated code. Thank you. I have a feature request if possible. Can you make the text replacement case insensitive? For example, typing test or Test would be able to have the replacement text applied instead of having to setup several of the same replacements to compensate for case.

EXCELLENT request! I agree, add me to this request as well.

SnickersTK 08-31-2006 04:03 PM

Quote:

Originally Posted by outlaw621
Working now with the updated code. Thank you. I have a feature request if possible. Can you make the text replacement case insensitive? For example, typing test or Test would be able to have the replacement text applied instead of having to setup several of the same replacements to compensate for case.

thirding this request

voteforbird 08-31-2006 09:02 PM

Thanks.

DrewM 09-01-2006 10:32 AM

Quote:

Originally Posted by outlaw621
Working now with the updated code. Thank you. I have a feature request if possible. Can you make the text replacement case insensitive? For example, typing test or Test would be able to have the replacement text applied instead of having to setup several of the same replacements to compensate for case.

I will try to do this in the next week you should see it soon.

EDIT: Currently it is case insensitive.

aLReeMi 09-01-2006 01:10 PM

great,
ThanKs

amnesia623 09-01-2006 05:04 PM

is this a permanent change to the post (changed when the user posts it or when it's read from the database)? because this looks like it could be a good april 1 add-on!

DrewM 09-01-2006 09:25 PM

no it changes the text that is displayed so the post is the same.

amnesia623 09-01-2006 11:23 PM

thank you

Keyser S?ze 09-02-2006 08:13 AM

this is a hack i have been waiting for for a long time, however i wish the adding new replacements system was better, but anyways, i guess im doing something wrong i thought i had understood it correctly

PHP Code:

newegg===<a href="http://www.newegg.com">NewEgg</a>
 ||| 
daemon tools===<a href="http://en.wikipedia.org/wiki/Daemon_tools">Daemon Tools</a

tying to replace newegg and daemon tools, newegg shows up as working properly

DrewM 09-02-2006 12:42 PM

Use this for your vboption:
Code:

newegg===<a href="http://www.newegg.com">NewEgg</a>|||daemon tools===<a href="http://en.wikipedia.org/wiki/Daemon_tools">Daemon Tools</a>

DeanoG 09-04-2006 10:14 AM

The hack is working great .. but I have noticed a problem with Links to external site.

is there any way the anythink with the BBcode [ url]....... [/ url] between them can be ignored by the plugin ?..


for example..

replacement code
Code:

microsoft===<a href="http://www.microsoft.com">microsoft</a>
it screws up live links ....

if some has posted a link in the post to the microsoft site it screws up ...

for example ...
Code:

http://www.microsoft.com/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx
is replaced by

Code:

http://www.microsoft.comcom/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx

DrewM 09-04-2006 02:21 PM

Quote:

Originally Posted by DeanoG
The hack is working great .. but I have noticed a problem with Links to external site.

is there any way the anythink with the BBcode [ url]....... [/ url] between them can be ignored by the plugin ?..


for example..

replacement code
Code:

microsoft===<a href="http://www.microsoft.com">microsoft</a>
it screws up live links ....

if some has posted a link in the post to the microsoft site it screws up ...

for example ...
Code:

http://www.microsoft.com/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx
is replaced by

Code:

http://www.microsoft.comcom/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx

I'm not planing on ignoring that but to fix this put your replacement code
to be:
Code:

microsoft ===<a href="http://www.microsoft.com">microsoft</a>

DeanoG 09-04-2006 03:04 PM

Quote:

Originally Posted by Larrysw
I'm not planing on ignoring that but to fix this put your replacement code
to be:
Code:

microsoft ===<a href="http://www.microsoft.com">microsoft</a>

Thanks for the suggestion ...

I already modified the code like you suggested before you posted a quick fix to correct the problem ...

like so ..
Code:

microsoft ===<a href="http://www.microsoft.com">microsoft </a>
the only difference was the extra space on..... >microsoft </A>
otherwise the word being replaced would join to the next word because the space would not be replaced.


Thanks

DeanoG

Stoebi 09-08-2006 08:45 PM

Hi

i've found some problems.

1.
For example:
php===<a href="http://de.php.net">PHP</a>

Post a message with the word php -> save
Quote these message and see the problem. Anyone confirm this behavior?

2.
Post a message with the word file.php -> save, reload and see. Anyone confirm this behavior?

3.
Post a message with http://your_url/php -> save, reload and see. Anyone confirm this behavior?

Edit:

4.
foo===foobar

post a message and enter this text:
foo and fooexample

Reload and see:
foobar and foobarexample

First word is correct, but not the second word.

Can anyone confirm all these behaviors? I'm working on a fix now. Any interests?

Regards, Stoebi


All times are GMT. The time now is 03:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01359 seconds
  • Memory Usage 1,857KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (21)bbcode_code_printable
  • (3)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete