The code is below - it utilizes a wordpress shortcode that is [my_hmg=widget.xml] but when you attempt alter the xml file such as this [my_hmg=example_gallery.xml] it simply always reverts towards the default widget.xml

The issue is within the function my_hmg_filter_Callback particularly these 2 lines

@$my_hmg_file = @$output['filename'];
if($my_hmg_file==""){$my_hmg_file = "widget.xml";}

For whatever reason it always thinks the file title is blank so always reverts to widget.xml.

The files obtainable came from here -

function my_hmg_show_filter($content){
    return  preg_replace_callback('/\[my_hmg=(.*?)\]/sim','my_hmg_filter_Callback',$content);

function my_hmg_filter_Callback($matches) 
    $my_hmg_package = "";
    $var = $matches[1];
    parse_str($var, $output);

    @$my_hmg_file = @$output['filename'];
    if($my_hmg_file==""){$my_hmg_file = "widget.xml";

First of all alter the short code to [my_hmg file='file.xml']

Then for those who have a fast read of Wordpress's short code API you'll notice that the very first argument within the callback function would be the characteristics from the short code.

By doing this you are able to the reference the attribute 'file' within the array and obtain the correct url.