Support » Plugin: WP FILE SEARCH » plugin does not handle .doc files, parser below to do that

  • The plugin does not search .doc files (“application/msword”)
    The parser below does that.
    Create a file with this code.
    Add the include of that file in class_wp_file_search around line 133
    Insert the appropreate call in class_wp_file_search around line 354

    <?php
    include_once ‘parser.php’;

    class DocParser
    implements Parser {

    public static
    function parse( $filename ) {
    $striped_content = ”;
    $content = ”;
    $fileHandle = fopen( $filename, “r” );
    $line = @fread( $fileHandle, filesize( $filename ) );
    $lines = explode( chr( 0x0D ), $line );
    $outtext = “”;
    foreach ( $lines as $thisline ) {
    $pos = strpos( $thisline, chr( 0x00 ) );
    if ( ( $pos !== FALSE ) || ( strlen( $thisline ) == 0 ) ) {} else {
    $outtext .= $thisline . ” “;
    }
    }
    $outtext = preg_replace( “/[^a-zA-Z0-9\s\,\.\-\n\r\t@\/\_\(\)]/”, “”, $outtext );
    write_log ($outtext);
    return $outtext;
    }

    }

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘plugin does not handle .doc files, parser below to do that’ is closed to new replies.