This site is powered by WordPress.

 

Autodownload

Autodownload enables your WordPress blog to provide links to files on your server.
Emphasize has been put on ease of use and thus it does most of the things automagically. Installation of Autodownload is easy and should not take more than 5 minutes (if not less!). Once Autodownload was configured you can used in your posts or pages. A simple function call automatically generates links to files in a given directory. Adding new links is then a matter of uploading files into this directory and does not need further interaction with WordPress. Optionally you can also add descriptions to the links and configure the html.

Features

  • Works with posts and pages
  • Nearly no configuration (one configuration variable!!!)
  • Automatically generates links to files and wraps them in list items or a html table
  • Multiple download sources within one post or page
  • Files can be sorted either by name or by modification time
  • Generates links for every occurrence of “file name” in a post or page text
  • Supports link descriptions
  • Include/Exclude patterns support

Installation

  1. Download autodownload from the wordpress plugin central
  2. Unpack the archive and upload it to your WordPress plugins directory (usually wp-content/plugins)
  3. [optional] If you want to change the default download root directory (it defaults to wp-content/) then go to the Autodownload options page and change it
  4. In any post or page you want to add links to files you must call ad__filesList(). The results of this call can be configured with parameters. For a list of available parameters and their meaning see the table below. A function call is always enclosed in a HTML comment.

    <!-- ad__filesList({dir=path/to/dir,wrap=table}) -->

    You may want to refer to the table below for an in-depth explanation of the arguments.
  5. [optional] If you want to add a description to the link either add a file named ad_descritions.desc (the first entry is for the first file, the second entry for second file, etc.) in the directory where your files reside in or, for each file in the directory, create a text file with the equal name but with extension .desc (i.e. myFile.tar.gz -> myFile.tar.gz.desc). A comment in, i.e. myFile.tar.gz.desc, has precedence over the global comments file (ad_descriptions.desc).

API change in version 1.4 and above! Autodownload now provides only one callable function ad_filesList() and a new function argument syntax. For backward compatibility though, the old functions can still apply and need not to be updated.


Arguments for ad__filesList()
Argument Comment
dir Relative path that is added to the root path defined in the Autodownload options. Only files from this directory are displayed.
sort Either date or name
wrap Is either table,ul, or li
wrap_attributes Can be any valid html attribute definition, for instance ...,wrap_attributes=style="font-size:bold;" id="someId",.... Just make sure that no comma is used as it is the separator for the different arguments
title Title to be displayed over the link list. If it is a table the title is printed enclosed in a th tag. If it is a list it is by default wrapped in a strong tag.
title_wrap Relevant only to ul|ol wrap mode. By default strong
title_wrap_attributes Attributes for the tile_wrap tag. Must be valid html (same syntax as wrap_attributes)
include preg pattern syntax. If provided only files that match this pattern are included! Note that the include pattern has precedence over the exclude pattern. Example: include=.*\.pdf would display only files ending with .pdf
exclude preg pattern syntax. If provided files that match this pattern are excluded! Note that the include pattern above has precedence over the exclude pattern.

Change log

  • 1.4 new features added (include/exclude), new function call syntax! Old syntax is still
    working for backwards compatibility
  • 1.3 bug fixes. if no description ‘array’ is outputed behind every download. trailing slash problem fixed.
  • 1.2.6 support for individual description files (one per file in directory)
  • 1.2.5 sizeof in for loop causes high cpu load in some php versions (4.0.2 and others?) corrected!
  • 1.2.4 minor changes in code
  • 1.2.3 Updated comments
  • 1.2.2 added new ad__* functions. handling extra parameters
  • 1.2 corrected nasty typos in autodownload.php, readme.txt, and admin.php (thanks to Paula and alternateroute for pointing this out to me)
  • 1.1 updatd text in readme.txt
  • 1.0 Bug fix: In the Autodownload options the first char of the root path has always been cut off if it was not a slash => added strpos bool return check. Renamed the files of autodownload: removed autodownload prefix on admin.php and commons.php
  • 0.9 Transforms occurrences of file name in the text of post/page matching file names of files in the directories into links
  • 0.2 Sorting now supported
  • 0.1 Initial version

Download

You can download autodownload from the wordpress plugin registry.

Need help or want to give feedback?

Post your question, critic, or comment to the Wordpress autodownload forum. Thanks!


16 Responses to “Autodownload”

  1. 1
    Ray Waldo:

    This is almost exactly what I want! Thanks. My primary request:
    1. Is there any way to add a short description to each file? I would prefer the ability to create/edit the descriptions via Wordpress but it would also be feasible to create a short text file with the same filename (but different extension) which would contain the short description.
    2. How would I go about creating page breaks for the list?
    3. If number 1 is not feasible, is there a way to fold the list into 2 or more columns?
    Thanks again. Even if the suggestions are not used, I still appreciate the plugin.
    Just a thought, until such time as you may be able to add the descriptions, I may be able to copy the html of the page which is created with the aid of your plugin, and then edit it and publish it as a static page.

  2. 2
    Fabio:

    @Ray Many thanks for your inputs, which I really appreciate!
    Let me answer your questions:
    1: At the moment there is no way of doing this, unfortunately. The code of the plugin is very simple. I have not thought about adding descriptions to a file from within Wordpress, but the idea is great! Descriptions taken from a file with the same name would be pretty straightforward to implement though. I will do that asap.
    2: Adding page breaks or any other html is not possible with this version :-( It is foreseen to allow arbitrary html to be passed to the function calls so that a user can change the behaviour, but again: it is not implemented yet.
    3: No.

  3. 3
    Ray Waldo:

    Any description would be fine. Thanks.

    I have given a bit more thought and for the paging, I have decided to break the files into groups and place them into different folders. That way, I can call the function on several different pages according to the group/folders.

    If you wish, you can follow my progress at http://chiefshepherd.com/downloads/

    Ray

  4. 4
    Fabio:

    Hi Ray.

    Again many thanks. What you requested is now partially implemented but the plugin is not yet uploaded into the Wordpress repository. It will take me another day to update the documentation and what goes with it. Just login into Wordpress and check if a new plugin version is available.
    Fabio

  5. 5
    Ray Waldo:

    You are a very responsive and GIVING person. Thank you for what you are doing.
    I am running into another problem - my site is now overloading the CPU at my hosting service. I have not changed anything except using the plugin. Could it be overusing the CPU? They mention that PHP scripts are one of the things that could be the problem.

  6. 6
    Fabio:

    Hello Ray

    It looks like this is a php bug. See http://bugs.php.net/bug.php?id=6608. If you are using php version 4.0.2 the sizeof function is most likely to be the problem. It may affect other php versions too. Nevertheless the code has been updated. The update should be available in the Wordpress repository shortly.

  7. 7
    Ray Waldo:

    Thanks. I have it working at http://chiefshepherd.com/downloads/

    However, the implementation of the description is almost self-defeating. In order to create the list, one may as well just write a page with the filenames, links and descriptions on it.
    My idea was to somewhat automate the process by creating a small text file for EACH file in a folder. So, when I upload a file (UPLOAD.ZIP) I will just upload the short description file (UPLOAD.DESC) with it. Then the plugin would create the listing with the filename in one column and the description (IF there was a .DESC file) in a second column. If there was no .DESC file, then it would just print the filename and go to the next file. (I used .DESC only as an example. The particular extension is of no consequence to me except that a dot filename is considered hidden in Linux and cannot be uploaded with SFTP.)

  8. 8
    Ray Waldo:

    One little “got’ya” that I ran into: DO NOT add a trailing slash after the path. If you do, it will output TWO slashes.

  9. 9
    Fabio:

    Thanks Ray.

    After thinking about your request (1) a bit more I came to the conclusion that I won’t provide a Wordpress backend to edit the file descriptions. The idea of the plugin is to handle downloadable files (and their description) without Wordpress.
    I agree with you that it could be easier to add the description for a file into its own file. The next release will handle both: Either one description file for every listed file in a directory or separate description files. If the former is present the latter is ignored. What do you think?

    Thanks for pointing me out the the trailing slash thing. The fix will be available with the next release.

  10. 10
    Fabio:

    Ray: I thought I would know what you mean by “adding a trailing slash after the path”. But unfortunately I do not. Could you explain me in greater detail what exactly you mean?

    By the way. A new plugin version is available. Check it out!

    Many thanks

  11. 11
    Ray Waldo:

    In the path varible, if I enter the path as serm/09/ then the actual link will be created as …..serm/09//filename.ext
    Note the TWO slashes. If I do NOT put the trailing slash in the varible, then the link is created correctly.
    On another post on your blog, I mentioned that I would like to give you a donation. Send me a note in email & I can do that.

  12. 12
    Ray Waldo:

    OK. I put the new version up with the individual .desc files and everything works! Thank you so much for doing this for us.

  13. 13
    Kipp Crigger:

    Thanks for this wonderful plugin. I ran into a problem after I updated to the lastest version of the plugin. After every download it has the word Array.

  14. 14
    Fabio:

    @Kipp: Please let me know if things are fixed in the newest version (1.3).

  15. 15
    blanaru:

    very nice

  16. 16
    www.produsedigitale.net/wordpress:

    very very nice

Leave a Reply