WordPress.org

Ready to get started?Download WordPress

Forums

AP Extended MIME Types
Plugin uses plugins_url, should be plugin_dir_path? (2 posts)

  1. bivald
    Member
    Posted 1 year ago #

    Hi,

    The plugin uses plugins_url (i.e it tries to download the file over HTTP, instead of opening the actual file on disc). This pretty much renders the plugin useless if you have strict PHP settings (i.e can't download files over http via file()).

    Following code uses the local file, instead of remote:

    [code]
    $file = 'mime-types.txt';
    $file = plugin_dir_path(__FILE__) . $file;
    $mime_file_lines = file($file);
    [/code]

    http://wordpress.org/extend/plugins/ap-extended-mime-types/

  2. lucile
    Member
    Posted 1 year ago #

    Thanks for the tip, it solved the following warnings:

    Warning: file() [function.file]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 40
    
    Warning: file(http://(...)/wp-content/plugins/ap-extended-mime-types/mime-types.txt) [function.file]: failed to open stream: Success in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 40
    
    Warning: Invalid argument supplied for foreach() in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 42

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic