Support » Plugin: WP-DownloadManager » Idea for using own file images

  • Resolved sixtyseven

    (@sixtyseven)


    Hi from Germany,

    Thanks for the effort you put into this plugin, it almost suits my needs perfectly. However, I came up with a very simple but effective enhancement: Why not wrap the functions file_extension_images() and file_extension_image($file_name, $file_ext_images) in a if(!function_exists()) ? With that simple wrap we would have the opportunity to overwrite the file icons with icons in a directory of our choice, for example in a child theme or a site specific plugin.

    Or if you don’t like to get your plugin’s function overwritten, maybe you could add a filter to the $dir in file_extension_images(), so one could point to a directory of choice? In this case, the function file_extension_image() could probably look like this:

    ### Function: Print Out File Extension Image
    function file_extension_image($file_name, $file_ext_images) {
    	$file_ext = file_extension($file_name);
    $icon_ext = apply_filters( 'wp-downloadmanager-icon-ext', '.gif');
    	$file_ext .= $icon_ext;
    	if( in_array( $file_ext, $file_ext_images, true ) ) {
    		return $file_ext;
    	}
    
    	return 'unknown'.$icon_ext;
    }

    Thanks again for that nice and effective plugin. Maybe you could consider my idea for a next update.

    • This topic was modified 1 month, 4 weeks ago by sixtyseven. Reason: typos
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.