Opened 9 years ago

Closed 8 years ago

#501 closed defect (fixed)

Patch for HtmlTidy plugin to use PECL

Reported by: Wil Clouser <wil.clouser@…> Owned by: gogo
Priority: normal Milestone:
Component: Plugin_HtmlTidy Version: trunk
Severity: normal Keywords: patch pecl
Cc:

Description

This is a quick patch to use PECL for tidy if proc_open isn't available, or tidy isn't installed on the system. This could happen if php is in safe mode (can't exec() stuff), or the admin won't install tidy. If PECL's tidy isn't available either, the string is passed through (like it already does).

For the file html-tidy-logic.php:

20c20
<       $process = proc_open("tidy -utf8 -config html-tidy-config.cfg", $descriptorspec, $pipes);
---
>       $process = @proc_open("tidy -utf8 -config html-tidy-config.cfg", $descriptorspec, $pipes);
42,43c42,50
<               // Better give them back what they came with, so they don't lose it all...
<               $newsrc = "<body>\n" .$source. "\n</body>";
---
>         /* Use tidy if it's available from PECL */
>         if( function_exists('tidy_parse_string') ){
>             $tempsrc = tidy_parse_string($source);
>             tidy_clean_repair();
>             $newsrc = tidy_get_output();
>         }else{
>             // Better give them back what they came with, so they don't lose it all...
>             $newsrc = "<body>\n" .$source. "\n</body>";
>         }

Change History (1)

comment:1 Changed 8 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed

Great patch Wil :) Applied in changeset:394

Note: See TracTickets for help on using tickets.