xhtml valid hack released!

Date 2006-03-21 01:43:00 | Category: XOOPS

in englishin japanese
All you have to do is copy a file "joke_xhtml_valid.php" into and edit mainfile.php
XHTML invalid site will be valid site!

... of couser,it's just a joke.
But this make the html-lint point of my site "10~20" point upper!
A line insertion into mainfile.php

	define('XOOPS_ROOT_PATH', '...');
	require XOOPS_ROOT_PATH.'/include/joke_xhtml_valid.php' ;


include/joke_xhtml_valid.php

<?php

ob_start( 'joke_xhtml_valid' ) ;


// ob filter
function joke_xhtml_valid( $s )
{
	$s = str_replace( '<br>' , '<br />' , $s ) ;
	$s = str_replace( '<hr>' , '<hr />' , $s ) ;
	$s = str_replace( '<br /><br />' , '<br />' , $s ) ;
	$s = preg_replace_callback( '/\<img [^>]+\>/' , 'joke_xhtml_valid_img_alt' , $s ) ;
	$s = preg_replace_callback( '/\<table [^>]+\>/' , 'joke_xhtml_valid_table_summary' , $s ) ;
	return $s ;
}

function joke_xhtml_valid_img_alt( $matches )
{
	if( stristr( $matches[0] , 'alt=' ) ) {
		return $matches[0] ;
	} else {
		return '<img alt="" ' . substr( $matches[0] , 5 ) ;
	}
}

function joke_xhtml_valid_table_summary( $matches )
{
	if( stristr( $matches[0] , 'summary=' ) ) {
		return $matches[0] ;
	} else {
		return '<table summary="dummy" ' . substr( $matches[0] , 7 ) ;
	}
}
?>




You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=87