vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Realtime Template Compressor: Reduces page sizes, loads pages faster, saves bandwidth (https://vborg.vbsupport.ru/showthread.php?t=83248)

Submerge 01-15-2006 11:57 PM

Quote:

Originally Posted by exegete
The solution to the paragraph bug is to alter the regular expression in such a way that newline characters appearing between textarea tags are left untouched.

I leave this as an exercise for the reader. :)

Not all of us are php experts :(

Smiry Kin's 01-16-2006 12:25 AM

donno if its cos im on 3.5.2

but i get:

XML Error: unknown at Line 0

Club3G 01-16-2006 12:27 AM

Quote:

Originally Posted by exegete
The solution to the paragraph bug is to alter the regular expression in such a way that newline characters appearing between textarea tags are left untouched.

I leave this as an exercise for the reader

Quote:

Originally Posted by Submerge
Not all of us are php experts :(

That's coder-speak for "I don't know how to do it". ;)

Even if the mod is bugged, IMHO it's still worth running on bigger forums if bandwidth is a concern.

ryuji 01-16-2006 12:52 PM

my variation of the script doesnt have the paragraph or javascript bugs, just dont uncomment the code i commented out as breaking stuff

natralis 01-16-2006 03:18 PM

works great for me
cheers

[Output: 42.78 Kb. compressed to 39.45 Kb. by saving 3.33 Kb. (7.77%)]

Totti 01-16-2006 03:28 PM

Quote:

Originally Posted by ryuji
these are the results of my experiments with the code... this one doesnt break anything and ill see if i can figure out a way to make it not bust javascript

PHP Code:

//Logician Hack:
//$page_byte=strlen($output);

//this broke scripts on my setup, if you want to test, click on 'more' smileys in advanced editor or try to bring up the user popup when you click on there name on a thread
                //$output=preg_replace ('/(\s*)\r\n(\s*)/', "", $output);
//this broke scripts on my setup, if you want to test, click on 'more' smileys in advanced editor or try to bring up the user popup when you click on there name on a thread


$output=preg_replace ('/\r\n(\s*)/'"\r\n"$output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);


//$pagenew_byte=strlen($output);
//$page_kilobyte=number_format(($page_byte/1024),2);
//$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
//$pagesaved_byte=$page_byte-$pagenew_byte;
//$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
//$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

//$output = str_replace('</body>', '<center><span class="smallfont">[Output: ' . $page_kilobyte . ' Kb. compressed to <b>' . $pagenew_kilobyte . '</b> Kb. by saving <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center></body>', $output);
//Logician Hack: 

remove the comments to re-enable the compression efficiency dialog


so that is the best working code at the moment?
still any known bugs then?

Club3G 01-16-2006 06:19 PM

I'm running that code, only the advanced editor bug. (It strips line breaks if you edit a post in advanced mode). Other than that, no problems whatsoever.

Riuji, unless you see a difference between my code and yours (I don't).
Code:

//Logician Hack:
$page_byte=strlen($output);
$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

$output = str_replace('</body>', '<center><span class="smallfont">[Output: ' . $page_kilobyte . ' Kb. CMP <b>' . $pagenew_kilobyte . '</b> Kb. Net <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center>
<br></body>', $output);
//Logician Hack:

I'd LOVE to see it keep a running tally in the admincp of kb saved.

ryuji 01-16-2006 10:02 PM

Quote:

Originally Posted by Club3G
I'm running that code, only the advanced editor bug. (It strips line breaks if you edit a post in advanced mode). Other than that, no problems whatsoever.

Riuji, unless you see a difference between my code and yours (I don't).
Code:

//Logician Hack:
$page_byte=strlen($output);
$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

$output = str_replace('</body>', '<center><span class="smallfont">[Output: ' . $page_kilobyte . ' Kb. CMP <b>' . $pagenew_kilobyte . '</b> Kb. Net <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center>
<br></body>', $output);
//Logician Hack:

I'd LOVE to see it keep a running tally in the admincp of kb saved.


i dont have the advanced mode issue you speak of does it go away if you comment out the code for the file size savings?

Club3G 01-16-2006 11:14 PM

Nope, it still does it. :(

ryuji 01-17-2006 11:22 AM

what version of vbb are you running and try commenting out the replacment lines and figure out just which one is breaking the advanced editor

Carnage 01-17-2006 01:03 PM

ok, well here is your solution to all the bugs. One problem is its in english and not php...

You need to parse out multiple white spaces + newlines in all of the code, you also need to remove html comments. HOWEVER you must ignore anything between <pre> <textarea> and <script> tags.

Ok well theres the brief... i'll see what i can do in a bit. (I think a good starting place would be to see how Vb3.5 handles bb tags especially the [nocode] tag or whatever it is that prevents bb code parsing between it.)

edit:
Well i've been messing arround for a bit and havn't got anywhere... The only 'hacked' solution i could come up with is to match the text area tags to a variable do the white space removal and put the text areas back in again.

ryuji 01-18-2006 03:07 AM

when i get bored ill try my hand at making it conditional... but with my setup it appears immune to the issue unless i use the commented out line of code instead of what i actualy had enabled

Carnage 01-18-2006 03:12 AM

this problem is really bugging me now... i haven't been able to come up with a singal working regex expression...

Guest210212002 01-18-2006 03:33 PM

Leaving it installed but disabling it for now. The linebreaks in advanced mode are just impossible to work around.

Guest210212002 01-19-2006 02:42 AM

Can this be modded to only strip commented out code?

ryuji 01-19-2006 09:33 AM

yes. comment out the fist replacment command

voleibolmurcia 01-20-2006 12:55 PM

How could i make that the text...

[Output: 37.45 Kb. compressed to 36.00 Kb. by saving 1.45 Kb. (3.87%)]

be in the same color that the background?

I dont find the template o the code in the footer for this hack.

Thank u.

Guest210212002 01-20-2006 01:33 PM

Quote:

Originally Posted by voleibolmurcia
How could i make that the text...

[Output: 37.45 Kb. compressed to 36.00 Kb. by saving 1.45 Kb. (3.87%)]

be in the same color that the background?

I dont find the template o the code in the footer for this hack.

Thank u.

From what I can tell by reading the thread a few times (don't hold me to this) the compression, and that expression, are processed before the templates themselves.

Your best bet is to try editing the plugin itself.

ryuji 01-20-2006 03:07 PM

Quote:

Originally Posted by Chris-777
From what I can tell by reading the thread a few times (don't hold me to this) the compression, and that expression, are processed before the templates themselves.

Your best bet is to try editing the plugin itself.

actualy... what he wants to change is processed after the page is completely made... so its after the templates

Dave-ahfb 01-20-2006 09:10 PM

just open the xml and find this line

Code:

$output = str_replace('</body>', '<center><span class="smallfont">[Output: ' . $page_kilobyte . ' Kb. compressed to <b>' . $pagenew_kilobyte . '</b> Kb. by saving <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center></body>', $output);

dodgechargerfan 01-20-2006 11:08 PM

So far so good. Even the paragraph issue seems to not be a problem.

*clicks install*

Edit: I should have mentioned that I am running 3.5.3.

XFSImperial 01-21-2006 12:32 AM

Nice hack, works fine on 3.5.3 :D

bada_bing 01-21-2006 01:41 AM

I would like to hear some feedback on people running this in vb 3.5.3 and if they had any problems

derekivey 01-21-2006 02:36 AM

I'm running it on my site, and I am having no problems with it :). It's working flawlessly for me.

Dave-ahfb 01-21-2006 02:43 AM

I am running it on 3.5.3...no problems

netcommander 01-21-2006 01:39 PM

I am testing it on 3.5.3 I will write again

thedvs 01-21-2006 02:13 PM

anyway to put the output in a nice place, some of us use custom skins and the output looks horrible outside the skin gfx and ruins the look of the board

any suggestions appreciated

ryuji 01-21-2006 03:33 PM

the issue is enable to calculate the space savings it needs to be completely done processing the page... just disable it.. all it does is use up more bandwith lol

seems that i am correct in earlier thinking that the issues are gone with 3.5.3?

darksoulz 01-21-2006 04:04 PM

we're on 3.5.3 and haven't noticed any problems.

Guest210212002 01-21-2006 04:21 PM

I'm on 3.5.3 and it strips line breaks if I advanced-edit a post. The only way I get around it is by commenting out:

Code:

//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);

Guest210212002 01-21-2006 04:22 PM

Quote:

Originally Posted by ryuji
yes. comment out the fist replacment command

Code:

//Logician Hack:
$page_byte=strlen($output);
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*? -->/',"",$output);

$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

That's the current contents of the plugin. If I'm understanding it correctly, I shouldn't see things like:

Code:

<!-- header Gallery Links-->
When I view my source if the comments are being stripped, correct? One of the main reasons is that I've been writing code for a living for ages now, and I tend to comment the hell out of every change I make. So people viewing my source tend to see some rather interesting comments. ;)

Code:

<!-- What the @#@$ did I screw up this time? -->
Because right now, this is my compression "Savings".

Code:

[Output: 0.00 Kb. compressed to 82.54 Kb. by saving -82.54 Kb. (0.00%)]
:(

ryuji 01-22-2006 02:43 PM

put a space before the --> there was a issue with it taking out code it wasnt supposed to.. i introduced the space before the -->

Guest210212002 01-22-2006 03:26 PM

[high]* Guest210212002 scratches his head
[/high]

There's a space in the original code snippet I posted, but I put another one in anyhow. ;)

Code:

//Logician Hack:
$page_byte=strlen($output);
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*?  -->/',"",$output);


$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

Still no love from that, I'm still seeing all of my commented stuff. :(

(Thank you very much for the help btw, ryuji, I appreciate you takin' the time to help me sort this out. :) )

Guest210212002 01-22-2006 03:38 PM

Quote:

Originally Posted by thedvs
anyway to put the output in a nice place, some of us use custom skins and the output looks horrible outside the skin gfx and ruins the look of the board

any suggestions appreciated

This won't move it, but if you at least want to change the look of it, add a CSS to you your MAIN statement for it, something like:

Code:

.compressor
{
color: #2886B6;
font: 10px verdana;
}

And then change the span class="smallfont" tag in the plugin itself to span class="compressor".

http://www.sevenstring.org/chris/comptext.jpg

On a nother note, I'd love it if someone could find a way to make this conditional work. I've tried it in a few places and haven't found something to make it happen.

Code:

$output = str_replace('</body>', '<if condition="in_array($bbuserinfo['usergroupid'], array(6))"><center><span class="compressor">[O: ' . $page_kilobyte . ' Kb C:<b>' . $pagenew_kilobyte . '</b> Kb. S: <b>' . $pagesaved_kilobyte . '</b> Kb. (' . $pagesaved_perc . '%)]</span></center></if></body>', $output);
//Compressor


Submerge 01-22-2006 06:59 PM

Running it on 3.5.3 and getting the paragraph break problem on Advanced Edit

ryuji 01-22-2006 09:40 PM

Quote:

Originally Posted by Chris-777
[high]* Chris-777 scratches his head
[/high]

There's a space in the original code snippet I posted, but I put another one in anyhow. ;)

Code:

//Logician Hack:
$page_byte=strlen($output);
//$output=preg_replace ('/\r\n(\s*)/', "\r\n", $output);
$output=preg_replace ('/<!-- .*?  -->/',"",$output);


$pagenew_byte=strlen($output);
$page_kilobyte=number_format(($page_byte/1024),2);
$pagenew_kilobyte=number_format(($pagenew_byte/1024),2);
$pagesaved_byte=$page_byte-$pagenew_byte;
$pagesaved_kilobyte=number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc=number_format(((100*$pagesaved_byte)/$page_byte),2);

Still no love from that, I'm still seeing all of my commented stuff. :(

(Thank you very much for the help btw, ryuji, I appreciate you takin' the time to help me sort this out. :) )

i meant in your templates... you can remove all the spaces but on my templates it removed code it wasnt supposed to when i did that, best way is to download the whole style and then use a find and replace to add a space to all of them

Smiry Kin's 01-22-2006 11:01 PM

with 3.5.2

and element skil.

it messes up the DHTML thing.. which is a pain really.. any way to sort this?

mox- 01-23-2006 09:35 AM

Wow, I just installed it and it seems to be working fine.

Is there a way to remove all <!-- comments --> in the code ? This would save a lot too.

Totti 01-23-2006 11:50 AM

mox- read the thread ... :D
All the last posts are about it ;)

My problem is that i got some
<!--
bloa
bla
blubb
-->
code which is not stripped at all ... any way sorting it out beside making it one line with <!-- xxx --> in code?!?

lightwave 01-23-2006 02:04 PM

where did you guys upload it tooo


All times are GMT. The time now is 03:35 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.01577 seconds
  • Memory Usage 1,842KB
  • 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
  • (12)bbcode_code_printable
  • (1)bbcode_php_printable
  • (10)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
  • (40)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