Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Text Replacement Links 1.1 (Updated!) Details »»
Text Replacement Links 1.1 (Updated!)
Version: 1.1, by Logikos Logikos is offline
Developer Last Online: Sep 2023 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 10-30-2004 Last Update: 04-27-2005 Installs: 35
DB Changes
Is in Beta Stage  
No support by the author.

Text Replacement Links


====================
Author: Ken 'LiveWire' Iovino
Site: www.vBhacks.us
Version: 1.1
====================

Updates
  • No longer will phrase the the link if the letters are being used. (Example) If google is one of my TextLinks, and a member post "I just got googlefied" It will not link it.
  • Mass Amounts of Queries per post fixed. This bug fixed by Kentaurus
  • No longer Case Sensitive. This bug fixed by nexialys

Huge Thanks
I have to give a huge thanks to the following members that have helped me get this hack where it is now. Xenon, Kentaurus, nexialys, Geographic2, and lewekleonek. Thank you guys very much!

What this does
This will allow you to specified any text you add to automatically turn into a link when your members post the word. For example, you go to the ACP and add the word 'google' to the list and then you add the 'url' to googles website, and anytime a member post the word google, it will automatically turn it into a link. See screenshots for example.


To do list...
  • Time to install: 3-5 minutes
  • Queries to run: 1
  • File Mods: 2
    • /admincp/index.php
    • /includes/functions_bbcodeprase.php
  • Templates to edit: 0
  • Templates to add: 0
  • New Phrases: 14

Please read carefully and make all the necessary changes as stated. This is will work if installed properly.
PLEASE REMEMBER TO BACKUP BEFORE YOU BEGIN! If you like this hack

Click It

Help & Support
Before asking for support Please make sure you have done all necessary changes! If you still need support please post a reply here.

Please post bugs and errors here. Hope you like, feedback welcomed.

Special Thanks and Credit to
-Xenon
-Kentaurus
-nexialys
-Geographic2
-lewekleonek

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-31-2004, 12:14 AM
Kentaurus's Avatar
Kentaurus Kentaurus is offline
 
Join Date: Dec 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try replacing:

PHP Code:
        $textlinks $DB_site->query(" SELECT text, link FROM " TABLE_PREFIX "textlink");
        
$findtext = array();
        
$replacetext = array();
        while(
$link $DB_site->fetch_array($textlinks))
        {
                
$findtext[] = $link['text'];
                
$replacetext[] = "[url=" $link['link'] . "]" $link['text'] . "[/url]";
        }
        
$bbcode str_replace($findtext$replacetext$bbcode); 
with

PHP Code:
    static $customReplaceInit false;
        static 
$findtext = array();
        static 
$replacetext = array();

    if (!
$customReplaceInit)
    {
            
$textlinks $DB_site->query(" SELECT text, link FROM " TABLE_PREFIX "textlink");
            while(
$link $DB_site->fetch_array($textlinks))
            {
                    
$findtext[] = $link['text'];
                    
$replacetext[] = "[url=" $link['link'] . "]" $link['text'] . "[/url]";
            }
        
$customReplaceInit true;
    }

        
$bbcode str_replace($findtext$replacetext$bbcode); 
that should help with your queries problem. I didn't test it but it should work

Take in consideration that we already have something called "replacement vars" that are configurable per style and that do "almost" the same thing that you are doing, except that they do it in a global way and not only in the post content. For words like google that are not part of any html or titles one might as well use replacement vars.
Reply With Quote
  #3  
Old 10-31-2004, 02:34 AM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the second time that I read about replacement vars. Where can I find that?

Ok never mind....
Reply With Quote
  #4  
Old 10-31-2004, 03:18 AM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ Kentaurus, Thanks alot i will test that right now.
Reply With Quote
  #5  
Old 10-31-2004, 03:23 AM
Remi Remi is offline
 
Join Date: Nov 2001
Location: London, UK
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

Is it posible to use this hack to rplace text with deferent text (not a link).

Thanks
Reply With Quote
  #6  
Old 10-31-2004, 03:25 AM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Remi
Hi

Is it posible to use this hack to rplace text with deferent text (not a link).

Thanks
Sure don't see why not, for example. If a user types the word LiveWire, you can have it be replace with, LiveWire is God. ^^
Reply With Quote
  #7  
Old 10-31-2004, 08:43 AM
HiDeo's Avatar
HiDeo HiDeo is offline
 
Join Date: Oct 2003
Posts: 306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lol, really nice job
Reply With Quote
  #8  
Old 10-31-2004, 08:55 AM
nexialys
Guest
 
Posts: n/a
Default

case-insensitive is explained in the preg_replace page...:

http://ca.php.net/manual/en/function.preg-replace.php

preg_replace ("/myWord/i", "myotherword", $thissentence);
...

and is quicker than str-replace in all situations...

... i never used the replacement thing in the templates, i find that really annoying,because it's template based, so filter all the output, not only the text you post.. annoying!

this one will be performing good!!!
Reply With Quote
  #9  
Old 10-31-2004, 04:13 PM
TheComputerGuy's Avatar
TheComputerGuy TheComputerGuy is offline
 
Join Date: Oct 2001
Location: TX
Posts: 580
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Didn't vB2 have this installed by default? I might be thinking Invision...

Either way nice hack!
Reply With Quote
  #10  
Old 10-31-2004, 04:30 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was testing that code mod that Kentaurus did but i was getting a timeout error. I finally got my computer back online so i'll be working on the hack tonight. (after halloween) ^^
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:28 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04564 seconds
  • Memory Usage 2,306KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete