Support » Plugin: Import external attachments » case-insensitive detection

  • Hey –

    Suggestion for improvement: Some old content has captialized HTML tags – e.g. “<IMG” instead of “<img”.

    I’d suggest you adjust the plugin code to account for this, by adding the case-insensitive flag (“/i”) to the end of your regex calls. That is, in “import-external-attachments.php”, around line 309-310, adjust the regex calls to:

    preg_match_all( '/<img[^>]* src=[\'"]?([^>\'" ]+)/i' , $post->post_content , $matches );
    preg_match_all( '/<a[^>]* href=[\'"]?([^>\'" ]+)/i' , $post->post_content , $matches2 );

    And btw – thanks for maintaining this plugin! Helping a client move from another CMS to WordPress, and we don’t have full access to the old site – so this saved me hours of manual import work!

    FWIW,
    twykr.

    • This topic was modified 2 years, 10 months ago by twykr. Reason: Fixing code line numbers to be correct
Viewing 1 replies (of 1 total)
  • Addendum thoughts: A couple other features I’d suggest:

    1. An “import ONLY from these domains” list option, as sometimes it’ll be easier to specific exactly which domains from which to import rather than a long list of other sites to block.

    2. The ability to ONLY do images, or ONLY do PDF files, rather than doing both all of the time.

    FWIW,
    twykr.

Viewing 1 replies (of 1 total)
  • The topic ‘case-insensitive detection’ is closed to new replies.