View Single Post
  #16  
Old 08-18-2004, 09:41 AM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dean C, The implementation is simpler than you think...

I can not speak to the FAQ idea, as I have not looked into that one, but I can speak to thread and post links.

1. Late in the processing of the bbcode parser, all links are full (no relatives allowed). All one has to do to know if it is on-site content is check the prefix of the URL -- does it start with $vboptions[bburl]? (1 strpos call)

2. Now all one needs to do to know what type of link it is, is look at the script name. For example, a post link is either showthread or showpost.

3. For these post-type URL's, there must be a "postid" parameter. Simply pluck the id that follows the parameter. (2 and 3 are done with one preg_match call).

4. Now you can call verify_id to get the post/thread information.

5. Return the <a> tag. The original link itself is unchanged. All we are adding is a little text between <a> and </a>.

This only runs if the post is not in the post cache, since it runs at the same time that [ url] tags are processed. I assure you that the cost is insignificant for the normal case of a link in a post. Sure, if a post had many links in it, the processing could become significant.

The added PHP code is not even measurable next to the bbcode parser, which is very large and inefficient, both from a code and a mem allocation point of view.

ps: As for FAQ references, I would compromise and not go any further than taking the reference following '#' in the URL. This would be no overhead as it would only involved a simple string extraction from the URL. It would transform a link like this (spaces added below to avoid URL parse in this post):

[ url] h t t p://www. foo .com/faq.php?faq=vb_read_and_post#faq_vb_email_notifica tion[ /URL]

and transform it to a link that did not open a new window and looks like:

FAQ: vb_email_notification.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01133 seconds
  • Memory Usage 1,765KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete