A few weeks ago (or was it months Embarassed ) I told that i was working on a plugin called NP_AttachFile. Today i put a first working version onine to test.
With this plugin you can 'attach' files to an item. But first things first: this plugin doesn't care about uploading files. It just gives you the possibility to enter a path or url to a file you want to link to. Also you can enter a description, contenttype and size.
Using the plugin you can by example:
- attach some files to an item and let them show up under the item in a nice looking table (use the skinvar <%AttachFile%> for this)
- add the attachments as enclosures in your rss-feed, by example to create podcasts (use the skinvar <%AttachFile(rss)%> for this)
This plugin is far from 'feature-complete' and may have security issues (i still have to check input etc), so I advise you only to test it on a development machine, or localhost.
I'm also not sure if the plugin will function on PHP4, still have to try this.
Features i still need to add/do:
- Autodetection of the contenttype and size (currently do not choose 'autodetect' for contenttype since this might generate errors)
- Admin area for the files (currently only available for filetypes)
- More predefined contenttypes
- a very big refactoring ("extract class" file & filetype)
Now you might be wondering why such a rather stupid plugin takes so much time?
The answer is rather simple: i'm trying to create a plugin with an ultimate layered design Laughing. If you dive into the code you'll see i:
If you want to run the UnitTests, download The SimpleTest framework from http://www.lastcraft.com/simple_test.php and extract it in 'nucleus/libs/simpletest'. Then you can run the tests by opening http://localhost/your/nucleus/installation/nucleus/plugins/attachfile/UnitTests.php . This will run all available UnitTests, currently 31. If everything goes well you'll see a green bar at the bottom with the text: "2/2 test cases complete: 31 passes, 0 fails and 0 exceptions.", if not, there is a problem Smile
This item was copied from my post a the forum
There are no comments.
Comment Atom Feed