vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Page Output Compression - Whitespace stripper. (https://vborg.vbsupport.ru/showthread.php?t=69787)

blueuniverse 11-28-2004 05:15 AM

Quote:

Originally Posted by Paul M
Which other one ?

That is basically the final version that people came up with - it uses the more agressive stripping except for the listed scripts, where it uses the 'lite' version.

The full one at the beginning. What I want really is just a lite version, which strips all the tags but won't affect the formatting in the post.

buro9 11-28-2004 07:47 AM

Quote:

Originally Posted by blueuniverse
The full one at the beginning. What I want really is just a lite version, which strips all the tags but won't affect the formatting in the post.

Originally I offered the hack in two parts... a full aggressive version and a lite version.

The hack was then modified by some users to run both parts according to which php file was being run... and this is a good idea so I changed the hack to reflect these modifications.

If you want just a lite version then the code is still there, just take out the bits that the aggressive version and the switch would need.

What this means is that where I now have this in the hack:
PHP Code:

// HACK : START : COMPRESS
$thisscriptis = array(
    
'editpost',
    
'register',
    
'newreply',
    
'newthread',
    
'sendmessage',
    
'private',
);

if (!
in_array(THIS_SCRIPT$thisscriptis)) {
    
$patterns = array('/\>\s+\</''/^\s*/m');
    
$replace = array('> <''');
    
$vartext preg_replace($patterns$replace$vartext);
} else {
    
$vartext preg_replace('/\>\s+\</''> <'$vartext);
}
// HACK : END : COMPRESS 

You only need this to have a lite version:
PHP Code:

// HACK : START : COMPRESS
$vartext preg_replace('/\>\s+\</''> <'$vartext);
// HACK : END : COMPRESS 

Note that we still recognised one scenario where this would be annoying... and that is when your forum is one where people are likely to post HTML or XML within their posts within PRE tags... as the formatting of that would also be changed.

So in that scenario the recommendation was that you don't run this hack... as it is designed to remove whitespace and that means that it re-formats HTML, XHTML, XML style text.

Anyhow... hope that helps.

blueuniverse 11-28-2004 08:03 AM

Ok then. Thats pretty simple. Anyway, thanks for the hack, hopefully it should speed stuff up significantly. :)

blueuniverse 11-28-2004 03:31 PM

Also, is the aggressive version a better bet for those who don't offer html in the posts. Are there any other disadvantages?

buro9 11-28-2004 09:58 PM

Quote:

Originally Posted by blueuniverse
Also, is the aggressive version a better bet for those who don't offer html in the posts. Are there any other disadvantages?

The difference is this:

The 'lite' version only collapses whitespace between HTML tags.

The 'aggressive' version collapses all whitespace, even where it does not occur between HTML tags.

There is no performance impact when using one over the other.

The difference is the output... the aggressive can remove more... but if you have people posting things like guitar tablature then the whitespace needed for formatting that is changed and it ruins it.

Because the lite version only touches the space between HTML, the lite version wouldn't affect that.

It just depends how much you want to remove :)

newtsys 01-14-2005 07:34 PM

very good I installed it on my 3.0.5 and it definately sped the forum up!

Bad Bunny 02-07-2005 06:09 PM

Thanks for the work. It does it's job, and even my small forum was sped up significantly. :)

Erwin 02-07-2005 08:55 PM

I still use this on 3.0.6 - works well. :)

Lord Brar 02-08-2005 01:57 AM

wow! I can't belive the pageloading times now!!! Thanks a lot for the hack mate!

Eternal2u 02-23-2005 12:44 PM

when you do this mod you ++++ the code tags..all the text inside the code is also on one line..which for some people isn't that big of a deal...for me it is..installed..then quickly uninstalled..


All times are GMT. The time now is 10:56 PM.

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.01569 seconds
  • Memory Usage 1,746KB
  • 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
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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