WP File-Tree
WP File-Tree is something I have been working on to help in my own development. There are tons of code-snippet, formatting, and coloring plugins out there. There are even a few for file management. What there is not, is one that combines them into one useful tool. I am talking about something of a s
WP File-Tree is something I have been working on to help in my own development.
There are tons of code-snippet, formatting, and coloring plugins out there. There are even a few for file management. What there is not, is one that combines them into one useful tool. I am talking about something of a script library manager, but also something that can be used to post ANY file. With this major goal in mind I started from the basics to build something on top of. What would be very useful from a developer standpoint, is getting my scripts out of their multiple locations and backups into one centralized location. Then post them to the world, all while using WordPress. The shortcode that WP File-Tree uses is the basis of how it streamlines this process.
So far, there are 4 plugin options:
Base Directory is the most important, and is exactly what it says, the root directory for WP File-Tree. It can be an absolute server path, or a relative path from your WordPress root directory. The important thing to note is that it can, and actually should be, outside of your web accessable htdocs directory on your web space. That is one of the points of this plugin, to be able to post files from a secure location on your web server.
There are 2 links to files the plugin uses. One is a URL to the file itself which loads it as your browser supports the mimetype. The second is a forced download link, which is almost the same as the first with additional headers.
The remaining 3 options control how these links work, similar to how WordPress sets permalinks. There are 2 choices for the option of link type, default , and mod_rewrite . Default simply uses query variables, while mod_rewrite actually modifies your .htaccess file independantly of WordPress rewrite rules which may have already been added.
Important note: For the rewrite rules, I found it was best to keep things separate from WordPress, because there is not much documentation on controlling the rewrite rules as far as .htaccess level, and there are still of view bugs on the WordPress side of this functionality. For the future releases, my plugin’s mod_rewrite rules will most likely change by becoming completely integrated with WordPress hooks, actions, and filters. For now, just for safety, make sure you activate your WordPress permalinks before activating the plugin’s.
Finally, the last two options are the link slugs, which are the base of the URL’s if the mod_rewrite type is active.
That about covers the options, now onto the shortcode.
shortcode:
It is all based around only 2 tags: [file path=”filename” /] [vfile path=”filename”]content[/vfile]