Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Title Tag Fetcher (Auto Replace URL with Titletag) Details »»
Title Tag Fetcher (Auto Replace URL with Titletag)
Version: 1.5c, by exportforce exportforce is offline
Developer Last Online: Jul 2016 Show Printable Version Email this Page

Category: Show Thread Enhancements - Version: 3.7.x Rating:
Released: 08-30-2008 Last Update: 08-31-2008 Installs: 89
Uses Plugins
 
No support by the author.

Hi there.

Since I needed a new URL Autotext Generator, I always loved the prework of Jafo232 and his Replace URL's With Page Title.
I just did some modifications on this Mod and for some forseeing mistypings, I also leaned out the checking of the "www" if given.

For those who don't know that mod it's quite simple:
If you post an URL in the Forums, this Mod just loads the <title>XXXXXX</title> out of the linked website.

The title won't be read if the following conditions occur:
  • The linked page simply has no <title>-Tag
  • The page is down or the <title>-Tag is not being found within the first 60 seconds
  • The <title>-Tag is not being found within the first 1000 lines of code.
Installation:
Just import the XML via the ACP and thats all.

Uninstall:
Just kill it out of your ACP.

01.09.2008 Update
Fixed Typo which got us a parse error

Download Now

File Type: zip Title Tag Replacer.zip (1.4 KB, 812 views)

Show Your Support

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

Comments
  #112  
Old 05-13-2017, 01:48 AM
mdawg's Avatar
mdawg mdawg is offline
 
Join Date: Mar 2009
Location: United States
Posts: 363
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have tried that yes - disabling AutoTagger but leaving this mod, which is the one I care about more, running, but still posts invisible and this PhP error:

With autotagger off, but external title fetcher ON (under php 7):

[12-May-2017 20:08:35 America/Los_Angeles] PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/*****/public_html/*****.com/forums/includes/functions_newpost.php(196) : eval()'d code on line 68
Reply With Quote
  #113  
Old 05-13-2017, 02:14 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could try editing the plugin from your AdminCP.

This seems to be what it doesn't like (at the very end of the plugin code - PLUGIN not PRODUCT):

Code:
	$messagetext = preg_replace(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siUe',
		"convert_url_to_bbcode_callback_auto_title('\\3', '\\1')",
		$messagetext
	);
No idea if this will work or not but you could try replacing that line with

Code:
	$messagetext = preg_replace_callback(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siUe',
		"convert_url_to_bbcode_callback_auto_title('\\3', '\\1')",
		$messagetext
	);
WARNING: If this breaks your forum and you can't get to your AdminCP, disable hooks so you can edit it back.
Reply With Quote
  #114  
Old 05-13-2017, 05:03 AM
mdawg's Avatar
mdawg mdawg is offline
 
Join Date: Mar 2009
Location: United States
Posts: 363
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do appreciate the help! but it did not solve anything.

When I switched out that code and tested it with PhP 5.6 running, the mod stopped fetching external titles, and the regular URL posted with no conversion to title.

Same result with PhP 7 running, whether I had the other mod (auto tagger), on or off - posts were no longer invisible, but the regular URL posted with no conversion to title.

i.e. the replaced code did eliminate the weird, invisible post behavior, but it also stopped the external title fetcher from fetching external titles, whether in PhP 5.6 or 7.
Reply With Quote
  #115  
Old 05-14-2017, 08:16 PM
Rhodium Rhodium is offline
 
Join Date: Apr 2016
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try that, works for me

replace
Code:
	$messagetext = preg_replace(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siUe',
		"convert_url_to_bbcode_callback_auto_title('\\3', '\\1')",
		$messagetext
	);
to
Code:
	$messagetext = preg_replace_callback(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siU',
                function($m) { return convert_url_to_bbcode_callback_auto_title($m[3], $m[1]); },		
		$messagetext
	);
Reply With Quote
2 благодарности(ей) от:
Lynne, MarkFL
  #116  
Old 05-15-2017, 08:19 PM
mdawg's Avatar
mdawg mdawg is offline
 
Join Date: Mar 2009
Location: United States
Posts: 363
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very good! thank you. Now the Title Tag Fetcher (Auto Replace URL with Titletag) mod works at my forum running 4.2.5 with PhP 7 enabled, without making posts invisible.


I wonder if you could take a look at this:
https://vborg.vbsupport.ru/showthrea...07#post2586407
for the other mod, Automatic Tagger From Message Content and Title - the issue seems to be similar in that the threads/posts are happening, but error codes interrupt the process.
Reply With Quote
  #117  
Old 06-11-2017, 09:02 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Rhodium View Post
Try that, works for me

replace
Code:
	$messagetext = preg_replace(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siUe',
		"convert_url_to_bbcode_callback_auto_title('\\3', '\\1')",
		$messagetext
	);
to
Code:
	$messagetext = preg_replace_callback(
		'#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siU',
                function($m) { return convert_url_to_bbcode_callback_auto_title($m[3], $m[1]); },		
		$messagetext
	);
This solves the blank pages problem on vB 4.7.5 with PHP 7.1

However, on two SSL (https://) forums, it no longer fetches the page title, whether the URL being fetched is https:// or http://

This is the entire updated plugin:

PHP Code:
if (!function_exists(convert_url_to_bbcode_callback_auto_title)) {
function 
convert_url_to_bbcode_callback_auto_title($messagetext$prepend)
{
    
$messagetext str_replace('\"''"'$messagetext);
    
$prepend str_replace('\"''"'$prepend);

    static 
$urlSearchArray$urlReplaceArray$emailSearchArray$emailReplaceArray;
    if (empty(
$urlSearchArray))
    {
        
$taglist '\[b|\[i|\[u|\[left|\[center|\[right|\[indent|\[quote|\[highlight|\[\*' .
            
'|\[/b|\[/i|\[/u|\[/left|\[/center|\[/right|\[/indent|\[/quote|\[/highlight';
        
$urlSearchArray = array(
            
"#(^|(?<=[^_a-z0-9-=\]\"'/@]|(?<=" $taglist ")\]))((https?|ftp|gopher|news|telnet)://|www\.)((\[(?!/)|[^\s[^$`\"'|{}<>])+)(?!\[/url|\[/img)(?=[,.!)]*(\)\s|\)$|[\s[]|$))#siU"
        
);

        
$urlReplaceArray = array(
            
"[url]\\2\\4[/url]"
        
);

        
$emailSearchArray = array(
            
"/([ \n\r\t])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[^\s]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/si",
            
"/^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[^\s]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/si"
        
);

        
$emailReplaceArray = array(
            
"\\1[email]\\2[/email]",
            
"[email]\\0[/email]"
        
);
    }

    
$text preg_replace_callback($urlSearchArray"auto_title"$messagetext);

    if (
strpos($text"@"))
    {
        
$text preg_replace($emailSearchArray$emailReplaceArray$text);
    }

    return 
$prepend $text;
}

function 
auto_title ($text) {

$options = array( 'http' => array(
        
'user_agent'    => 'VBulletin Titletag Fetcher',
        
'max_redirects' => 10,
        
'timeout'       => 60,
    ) );
$context stream_context_create$options );

if (
$text[2] == 'www.' or $text[2] == 'Www.' or $text[2] == 'wWw.' or $text[2] == 'wwW.' or $text[2] == 'WwW.' or $text[2] == 'WWw.' or $text[2] == 'wWW.' or $text[2] == 'WWW.') { $text[4] = $text[2] . $text[4]; $text[2] = 'http://'; }

$paged    = @fopen$text[2] . $text[4], "r" ); #echo $page . "DONE"; 
if ($paged) {
    while (!
feof($paged) and ($x 1000)) { $page .= fread($paged8192); $x++; }
    
fclose($paged);
}

preg_match("/<title>[\n\r\s]*(.*)[\n\r\s]*<\/title>/"$page$title);

if (
$title[1] == '') { $title[1] = $text[2] . $text[4]; }
return 
"[url="" . $text[2] . $text[4] . ""]" preg_replace("/\&.+\;/"''$title[1]) . "[/url]";
}

}

    
$messagetext preg_replace_callback(
        
'#(^|\[/(' $skiptaglist ')\])(.*(\[(' $skiptaglist ')|$))#siU',
                function(
$m) { return convert_url_to_bbcode_callback_auto_title($m[3], $m[1]); },        
        
$messagetext
    
); 
RESOLVED:

See https://vborg.vbsupport.ru/showthread.php?t=323627

You need to have this setting enabled:

allow_url_fopen = On
Reply With Quote
  #118  
Old 06-11-2017, 09:54 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To simplify updating for PHP 7.x, use attached product. The text files are for information only: Just delete the 1.5c version and import the new xml product (no files to upload).

Also posted at https://vborg.vbsupport.ru/showthread.php?t=325234

Please post there for support and I'll do what I can to help.
Attached Files
File Type: zip Title Tag Replacer for PHP 7.1.zip (2.1 KB, 12 views)
Reply With Quote
Благодарность от:
BirdOPrey5
  #119  
Old 06-13-2017, 12:10 PM
mdawg's Avatar
mdawg mdawg is offline
 
Join Date: Mar 2009
Location: United States
Posts: 363
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks djbaxter. So, I did what rhodium suggested in post #114 but what you updated and attached there is different?
Reply With Quote
  #120  
Old 06-13-2017, 12:28 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mdawg View Post
Thanks djbaxter. So, I did what rhodium suggested in post #114 but what you updated and attached there is different?
How is it different?
Reply With Quote
  #121  
Old 06-13-2017, 12:42 PM
mdawg's Avatar
mdawg mdawg is offline
 
Join Date: Mar 2009
Location: United States
Posts: 363
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm just asking if it is different. I simply did what Rhodium suggested it seems to work, but my forum is http not https.
Reply With Quote
Благодарность от:
djbaxter
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:48 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.05592 seconds
  • Memory Usage 2,382KB
  • Queries Executed 28 (?)
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
  • (6)bbcode_code
  • (1)bbcode_php
  • (2)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
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete