WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Random File

Retrieve the name, path, or link to a randomly chosen file or files in a specified directory.

1.8 (2014-01-11)

  • Add unit tests
  • Fix bug to actually permit multiple extensions to be specified
  • Change casting $number from intval() to absint() in c2c_random_files()
  • Minor code changes (spacing, bracing)
  • Note compatibility through WP 3.8+
  • Update copyright date (2014)
  • Minor readme.txt tweaks
  • Change donate link
  • Add banner

1.7.1

  • Add check to prevent execution of code if file is directly accessed
  • Note compatibility through WP 3.5+
  • Update copyright date (2013)

1.7

  • Use DIRECTORY_SEPARATOR instead of hardcoding '/' when determining absolute path
  • Properly escape the attributes for the link markup
  • preg_quote() the extensions
  • Cast $exclusions arg to array before use
  • Re-license as GPLv2 or later (from X11)
  • Add 'License' and 'License URI' header tags to readme.txt and plugin file
  • Minor code reformatting (spacing)
  • Remove ending PHP close tag
  • Note compatibility through WP 3.4+
  • Drop support for versions of WP older than 2.8

1.6.2

  • Note compatibility through WP 3.3+
  • Add link to plugin directory page to readme.txt
  • Add Upgrade Notice section to readme.txt
  • Update copyright date (2012)

1.6.1

  • Note compatibility through WP 3.2+
  • Minor code formatting changes (spacing)
  • Minor readme.txt formatting changes
  • Add plugin homepage and author links in description in readme.txt
  • Update copyright date (2011)

1.6

  • Add c2c_random_files() to retrieve array of random unique files
  • Add hooks 'c2c_random_file' (filter) and 'c2c_random_files' (filter) to respond to the function of the same name so that users can use the apply_filters() notation for invoking template tags
  • Use get_option() instead of deprecated get_settings()
  • Wrap functions in if(!function_exists()) check
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Tweak description
  • Note compatibility with WP 3.0+
  • Minor tweaks to code formatting (spacing)
  • Add Filters and Upgrade Notice sections to readme.txt
  • Remove trailing whitespace

1.5.2

  • Add PHPDoc documentation
  • Note compatibility with WP 2.9+
  • Update copyright date
  • Update readme.txt

1.5.1

  • Fixed: missing '/' in path construction for reftype 'absolute'

1.5

  • Added new reftype of 'hyperlink' to return the filename of the random file hyperlinked to that file
  • Added error checking to avoid error when referenced directory does not exist
  • Added error checking for when there is an error opening a directory
  • Explicit handling of reftype 'absolute' in the code was actually supposed to be 'serverabsolute'
  • Minor code tweaks
  • Tweaked installation instructions
  • Added readme.txt
  • Noted and tested compatibility with WP 2.3.3 through 2.8

1.0

  • Renamed function from random_file() to c2c_random_file()
  • Added new reftype of 'filename'
  • Added optional array argument $exceptions for files not to be considered in random file selection
  • Updated license and examples
  • Verified that plugin works in WP 1.5 (and still works in WP 1.2)

0.9

  • Initial release

Requires: 2.8 or higher
Compatible up to: 3.8.3
Last Updated: 2014-1-12
Downloads: 18,324

Ratings

4 stars
4.5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,2,2
100,2,2 100,1,1
100,1,1
100,1,1
0,1,0
100,1,1
100,1,1