buceta
Members-
Posts
12 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
buceta's Achievements
Newbie (1/5)
0
Reputation
-
Thanks for attention. Your change work fine, no more errors. But the class dont work properly... Always replace the script and <concompress> content with MD5 :~~~ I need change the function above, but what?
-
Hi, this is one try mine to make one class, the original content are simples functions. [code] <?php class general_function { function compress_html($output) { $this->output = $output; // output is the html code // init some variables/arrays $page_byte = strlen($this->output); $ascript = array(); $atext = array(); $apre = array(); // cut from output, and store away for later re-inclusion, everything between <textarea> and <pre> tags // (we do not want to touch those blocks as they may contain wanted whitespace) $this->output=preg_replace_callback('/<textarea.*?[^\btextarea>\b]*?textarea>/si', "cb_text", $this->output); $this->output=preg_replace_callback('/<pre.*?[^\bpre>\b]*?pre>/si', "cb_pre", $this->output); // also cut and save <nocompress> tagged text (intentional excluded parts) $this->output=preg_replace_callback('/<nocompress.*?[^\bnocompress>\b]*?nocompress>/si', "cb_text", $this->output); // strip all whitespace at the beginning of every new line (but leave the linebreak intact) $this->output=preg_replace('/(\r)?\n(\s*)/', "\n", $this->output); // cut from output, and store away for later re-inclusion, everthing between <script> tags // (we don't want to strip the linebreaks from script code since that would render the scripts non working) $this->output=preg_replace_callback('/<script.*?[^\bscript>\b]*?script>/si', "cb_script", $this->output); // strip all linebreaks and HTML-Comments from the output // (since we first strip all linebreaks, even multi-line comments will get striped this way! :-)) $this->output = str_replace("\n" ," " ,$this->output ); $this->output = preg_replace('/\/\*.*?[^\b\*\/\b]*?.*?\*\//',"" , $this->output); $this->output = preg_replace('/<!--[^\{\[\]*?[^b<!--\b]*?[^\b-->\b]*?-->/i', "", $this->output); // We exclude HTML comments containing "{" and "[" // this way CSS definitions and AnyMedia stuff won't get striped // re-insert everything we saved before foreach ( $ascript as $block) { $this->output = str_replace( $block[1] , $block[0] , $this->output ); } foreach ( $atext as $block) { $this->output = str_replace( $block[1] , $block[0] , $this->output ); } foreach ( $apre as $block) { $this->output = str_replace( $block[1] , $block[0] , $this->output ); } // last not least: strip any remaining multiple spaces between tags... $this->output = preg_replace('/>[\s]+</', "> <" ,$this->output ); // ...and also strip the <nocompress> tags for keeping any XHTML compliance $this->output = str_replace("<nocompress>" ,"" ,$this->output ); $this->output = str_replace("</nocompress>" ,"" ,$this->output ); // calculate some nice looking numbers :-) $pagenew_byte = strlen($this->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); $cmprstats = "<div align='center'><em>compress ratio: </em>$pagenew_kilobyte k/$page_kilobyte k (<strong>$pagesaved_perc%</strong>)</div>"; $this->output = str_replace('</body>', $cmprstats . "</body>" , $this->output); // print the result or return? echo $this->output; //return $this->output; } // definition of callback functions function cb_script($matches) { global $ascript; $i = count($ascript) + 1; $h = md5($matches[0]); $ascript[$i][0] = $matches[0]; $ascript[$i][1] = $h; return $h; } function cb_text($matches) { global $atext; $i = count($atext) + 1; $h = md5($matches[0]); $atext[$i][0] = $matches[0]; $atext[$i][1] = $h; return $h; } function cb_pre($matches) { global $apre; $i = count($apre) + 1; $h = md5($matches[0]); $apre[$i][0] = $matches[0]; $apre[$i][1] = $h; return $h; } } ?> [/code] I always get this error: Warning: preg_replace_callback() [function.preg-replace-callback]: requires argument 2, 'cb_text', to be a valid callback in .... line 17 Warning: preg_replace_callback() [function.preg-replace-callback]: requires argument 2, 'cb_pre', to be a valid callback in .... on line 18 Warning: preg_replace_callback() [function.preg-replace-callback]: requires argument 2, 'cb_text', to be a valid callback in .... on line 20 Warning: preg_replace_callback() [function.preg-replace-callback]: requires argument 2, 'cb_script', to be a valid callback in .... on line 27 How to fix this? What is wrong? Sorry, I'm not a expert in php, but I want be one! lol and please moderators, dont del this topic, just close it if the rules dont permit
-
Sorry, I'm flat!! But I want an gmail loading message clone!!! open emails in gmail and you will see the message..
-
google mail = gmail And get an gmail account is easy ;/
-
hmm.. Its hard to I understand, but will try
-
Thanks for reply, but this idea are very sux! The dynamicdrive.com I grabbe many scripts. But I need exact like google wait message. Please access www.gmail.com and your account and see the wait message and move your scroll bar.
-
Then anyone have the solution?
-
[!--quoteo(post=370483:date=May 2 2006, 03:03 AM:name=GBS)--][div class=\'quotetop\']QUOTE(GBS @ May 2 2006, 03:03 AM) [snapback]370483[/snapback][/div][div class=\'quotemain\'][!--quotec--] lol,,,,,,, buceta,, have you heard of some words like 'php/mysql' or even 'Ajax'....? :D <? change order,, submiting,,,,,,,,,,,,,,,,,, replace & save changes in DB ! ?> l8tr,, :) [/quote] Off course, php and ajax , but how to know the new order if you change only the table? The main question is: How to grabbe the new order in your php? I cant see this in my mind.
-
ok, and how to save to DB the new order? ahhahhahahahahah
-
An code test for you by me: [code]<form action="http://www.phpfreaks.com/" method="post" onSubmit="win=window.open('','janela','toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width=860,height=600,left = 80,top = 40'); this.target='janela';"> <input type="submit" value="test submit"> </form>[/code] ;)
-
Hi, I have an question about this script.. I want a loading message to my ajax system, like in gmail. This script using css absolute, work fine, but not work like the gmail div. I want that messate stay always on top if user down or up scroll bar. My english is very poor, sorry. You understand my question?