Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- // Документация к tidy http://php.net/manual/ru/book.tidy.php
- error_reporting(0);
- $html = $_POST['html'];
- $config = array( 'indent' => false,
- 'output-xhtml' => false,
- 'show-body-only' => 1,
- 'wrap' => 200);
- $Tidy = new tidy();
- $Tidy->parseString($html, $config, 'utf8');
- $Tidy->cleanRepair();
- $html = $Tidy;
- preg_match_all("#\<(.*?)\>#s", $html, $otv,PREG_OFFSET_CAPTURE);
- //print_r($otv);
- for($i=0;$i<count($otv[0]);$i++){
- if($otv[1][$i][0] == $otv[1][$i+1][0]) {
- $html = str_replace("<".$otv[1][$i][0]."><".$otv[1][$i][0].">", "<".$otv[1][$i][0].">", $html);
- }
- }
- $Tidy->parseString($html, $config, 'utf8');
- $Tidy->cleanRepair();
- echo "<pre>" . htmlspecialchars($Tidy) . "</pre>";
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- </head>
- <body>
- <div class="main">
- <div class="main-inner">
- <div class="container">
- <div class="row">
- <div class="span12">
- <div class="widget ">
- <div class="widget-header">
- <h3></h3>
- </div> <!-- /widget-header -->
- <div class="widget-content">
- <p class="help-block">HTML текст</p>
- <form id="edit-profile" action="1.php" method="post">
- <textarea name="html"> </textarea> <br>
- <br>
- <input type="submit">
- </form>
- </div>
- </div> <!-- /widget-content -->
- </div> <!-- /widget -->
- </div> <!-- /span8 -->
- </div> <!-- /row -->
- </div> <!-- /container -->
- </div> <!-- /main-inner -->
- </div> <!-- /main -->
- <script src="js/jquery-1.7.2.min.js"></script>
- <script src="js/bootstrap.js"></script>
- <script src="js/base.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement