This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

file:/// at the SiteOrigin Button not working

Resolved 13 replies pluginplugin-page-builder
11 years ago · Last reply by Andrew Misplon 11 years ago

Hi everybody,

i have the problem that WordPress cannot use the “file:///servername/folder/file.txt” protocol (‘file:///’) and because of that the SiteOrigin buttons either.

I have made the Intranet Site of a company with the Vantage CMS and noticed that i cannot open files, folders etc. with the file:/// protocol… with smb:// protocol for MAC users everything works absolutely fine.

So can you tell me where and which file i can edit to add ‘file’ to the $protocols?
And how to use it then for the SiteOrigin Buttons?

Thank you very much in advance.

Greetings

Philip

PS: maybe this Thread helps you : https://wordpress.org/support/topic/link-to-local-file
but for me the Plugin unfortunately does not work :-(

URL: https://wordpress.org/support/topic/link-to-local-file

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

13
  1. Andrew Misplon Staff 11 years, 4 months ago

    Hi Philip

    Thanks for your support.

    Have you perhaps tried the solution outlined at the end of that thread? Basically saving this as a file: https://gist.github.com/rosshanney/3437658, save as allow-file-protocol.php and then inserting that file under /wp-content/plugins/

  2. Andrew Misplon Staff 11 years, 4 months ago

    Here is that file zipped. You can download and install it via Plugins > Add New > Upload Plugin:

    https://siteorigin.com/wp-content/uploads/2014/09/allow-file-protocol.php_.zip

    Let me know how it goes.

  3. Philip Scheida 11 years, 4 months ago

    Hi Andrew,

    Yes i already tried it but does not work :-(

    in the formations.php the “file” protocol isn’t declared but is it possible that the apache server is blocking it?
    do you have any ideas?

    thank you for answering :-)

  4. Andrew Misplon Staff 11 years, 4 months ago

    Sorry to hear that’s not working. I did some digging now and unfortunately couldn’t find any better threads on this. I see one or two on Stackoverflow but no answers as of yet. Let me take another look later today and come back to you.

  5. Philip Scheida 11 years, 4 months ago

    thank you very much for your help! :-)

    I found out that in the functions.php the $protocols array is defined and ‘file’ is not filled in.. tried out if it works when i add… and see… the buttons take the file://Y:/servername/folder_/filename.txt but the click event does not do anything… so im on this thing… maybe you find out something more…

    thanks in advance

    pleased to hear from you

  6. Philip Scheida 11 years, 4 months ago
    /**
    4244	 * Retrieve a list of protocols to allow in HTML attributes.
    4245	 *
    4246	 * @since 3.3.0
    4247	 *
    4248	 * @see wp_kses()
    4249	 * @see esc_url()
    4250	 *
    4251	 * @return array Array of allowed protocols.
    4252	 */
    4253	function wp_allowed_protocols() {
    4254	        static $protocols;
    4255	
    4256	        if ( empty( $protocols ) ) {
    4257	                $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp' );
    4258	
    4259	                /**
    4260	                 * Filter the list of protocols allowed in HTML attributes.
    4261	                 *
    4262	                 * @since 3.0.0
    4263	                 *
    4264	                 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
    4265	                 */
    4266	                $protocols = apply_filters( 'kses_allowed_protocols', $protocols );
    4267	        }
    4268	
    4269	        return $protocols;
    4270	}
  7. Andrew Misplon Staff 11 years, 4 months ago

    We had another look at the initial plugin you linked to and that I posed a ZIP version of. It should work. Is there any chance that caching on your side perhaps prevented the changes from taking effect? Is there is caching plugin running on your installation?

  8. Philip Scheida 11 years, 4 months ago

    im running the intranet site via XAMPP. is that a problem?

  9. Andrew Misplon Staff 11 years, 4 months ago

    I’m not sure. This is unfortunately an area I haven’t looked into yet so I’m, by the sounds of it, at a similar level to you in terms of cracking this. It might be worth also popping a question on Stack Overflow to see if you can’t get a better answer there. We’ll certainly help out where we can but unfortunately don’t have anything definitive right now.

  10. Philip Scheida 11 years, 4 months ago

    thank you very much for your help.

    keeping you up to date :-)

  11. Andrew Misplon Staff 11 years, 4 months ago

    For sure, please do let us know how this turns out.

  12. Philip Scheida 11 years, 4 months ago

    Hey andrew,

    finally found the problem and solved it more or less.
    The core of my problem is that every Browser blocks the UNC paths for security issues. (like attacks on server through the UNC file:// protocol)

    The only browser that allows this UNC file:// path is the IE after handling the security settings.
    In Firefox there has to be an adoption in the core files to allow it.

    Besides the Plugin we talked above needs to be installed to make sure the SiteOrigin Button or every other Link in WordPress take the file:// URL, if its not installed the wordpress esc_url() function deletes it and replaces it with a http:// URL.

    So i can recommend:

    To use a Intranet (local) the best way is to have the files directly on that drive to call them via the IP Adress.

    In our case we have the XAMPP web server which needs to connect to the Fileserver, but it’s not possible to reach it via IP. For that reason the UNC file:// patch works here in IE.

    Thank you for your Help.

    Philip

  13. Andrew Misplon Staff 11 years, 4 months ago

    Hi Philip, thanks for coming back to us on this unique challenge. I’m sure users will at some point appreciate this thoughtful feedback you’ve provided.

    All the best for your future projects.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread