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
  #52  
Old 01-27-2005, 08:34 AM
Skyline_GT Skyline_GT is offline
 
Join Date: May 2003
Location: Vancouver, BC
Posts: 482
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this hack doesn't work at all..
Reply With Quote
  #53  
Old 01-28-2005, 10:00 PM
Sal Collaziano Sal Collaziano is offline
 
Join Date: Dec 2001
Location: Royal Palm Beach, Florida
Posts: 232
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Somebody should continue to work on this. It's a really great option for advertisers. Not only does their banner ad show (if they have one), but any time their company name is addressed, it can link to their web site...
Reply With Quote
  #54  
Old 02-09-2005, 07:44 PM
Robert Basil's Avatar
Robert Basil Robert Basil is offline
 
Join Date: Oct 2001
Location: Chandler, Arizona
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The hack works great for me. But with the "spaces" addition it will not work if the word to be replaced is the first or last word in a post.
Reply With Quote
  #55  
Old 02-18-2005, 12:38 PM
aspen0 aspen0 is offline
 
Join Date: Apr 2003
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got it working with the code (case insensitive) posted by Geographic2.

One bug I noticed though -- it doesn't handle phrases.

I can't replace 2 word phrases. So I couldn't replace say "Golden Retreiver" with a link to a description of the breed.

Limitation of the system? Or something easily fixed?
Reply With Quote
  #56  
Old 03-26-2005, 05:42 PM
Geographic2 Geographic2 is offline
 
Join Date: Apr 2003
Location: On the map
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you don't like the way it is parsing things then come up with a better regular expression to cover what you are looking for. I'm happy with the way this one has performed for me. Here it is running on my Glossary of Botanical Terms which is integrated with my WIKI. I personally feel there are already enough links being made without including the ones which appear with punctuation etc. I'd actually think of making it limit the # of links more that create more than there is like this.


If you want to check to see if it's at the end of a sentence or followed by a comma simply define it in the regex:
Code:
                    $findtext[] = "/\s".$link['text']."\s/i";
Instead of looking for just a space at the end, you need to look for space or any punction marks ? , . ! etc... Or....

Instead of blocking the replacement of what are already URL's which is the reason I introduced the search for " word " instead of "word" in the first place way back when, you could search for "Not [" and "Not ]" to prevent the url bbcode from being broken. I'm a big fan of people learning how to do things, so somebody learn and figure it out.

I can get mine to cover 2 word phrases, not sure why yours will not.
I am using the same regex I posted here... Here I am replacing the phrase "Giant Vegetables", when I put it in via the admin CP i don't include the quotation marks.
http://www.giantvegenetics.com/gv/sh...9&page=3&pp=10

Code:
                    $findtext[] = "/\s".$link['text']."\s/i"; 
                    $replacetext[] = " " . $link['text'] . " ";
Reply With Quote
  #57  
Old 04-19-2005, 03:44 AM
lewekleonek's Avatar
lewekleonek lewekleonek is offline
 
Join Date: Jul 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is another fix to the fix of the fix (just kidding).
Yet another thought before I'll move on to the fixed code posting - make sure that the version of the php your server is runing has PCRE enabled; navigate to your admin control panel, go to 'Import & Maintenance' section; click on 'View PHP Info' link. Once you are able to view PHP info in the main panel please search for 'pcre':
PCRE (Perl Compatible Regular Expressions) Support enabled
If the line is missing the code may not work for you.

What's fixed:
- now it works with phrases
- works with both words and phrases at the beggining or the end of the post
Enjoy it:
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[] = "/(\s+|^)".$link['text']."(\s+|$)/i";
                    $replacetext[] = " " . $link['text'] . " ";
            }
        $customReplaceInit = true;
    }

        $bbcode=preg_replace($findtext, $replacetext, $bbcode);
/LL
Reply With Quote
  #58  
Old 04-28-2005, 11:28 AM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey everyone, i'm back for good now and i'll be able to start updating and supporting my hacks. I just read the thread and i have to thank everyone who has contributed there time to trying to make this hack work while i was away. I am going over the code now and will have an update very shortly with all fixes. Thanks again!
Reply With Quote
  #59  
Old 04-28-2005, 01:48 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice to see you back (for good???).
Reply With Quote
  #60  
Old 04-28-2005, 03:04 PM
Prince Prince is offline
 
Join Date: Oct 2001
Posts: 333
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works!

Thanks!
Reply With Quote
  #61  
Old 04-28-2005, 04:14 PM
Prince Prince is offline
 
Join Date: Oct 2001
Posts: 333
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

everything works great, but I do get an error every time I add a new text link in the redirect window:

Cannot find phrase: "saved_text_link_x_successfully'
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 12:22 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.04910 seconds
  • Memory Usage 2,311KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_code
  • (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
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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