[11]Backreferenced regexp in JFolder::files and folders

Locked
RoscoHead
Joomla! Explorer
Joomla! Explorer
Posts: 318
Joined: Mon Jul 30, 2007 11:01 pm
Location: Melbourne, Australia
Contact:

[11]Backreferenced regexp in JFolder::files and folders

Post by RoscoHead » Thu Mar 20, 2008 11:22 pm

  1. IntroductionCurrently, when traversing a folder for files or folders, the complete file/folder name is returned. I see a need to be able to, for instance, return the filename without an extension, or a substring of the folder name.

  2. Technical ImplementationThis would simply involve the use of the regexp backreference system to allow the user to specify a filter like /(.+)\..+/ returning the first backreference as the name, instead of the whole name.

  3. ImpactThis should not affect the current implementation, unless the programmer has used backref brackets in their regexp for their own requirements (they are currently ignored by Joomla). Non-capturing parentheses (?..) would not be affected.

    If used, this would override the fullpath parameter (which defaults to false anyway).

  4. Referenceshttp://forum.joomla.org/viewtopic.php?f=38&t=253009

pasamio
Joomla! Ace
Joomla! Ace
Posts: 1318
Joined: Thu Aug 18, 2005 9:27 am
Location: San Jose, CA, USA
Contact:

Re: [11]Backreferenced regexp in JFolder::files and folders

Post by pasamio » Thu Apr 03, 2008 1:02 pm

Regexp needs to be changed to something like this perhaps:
/(.+)\.(^\.)+/
Or (being greedy):
/(.*)\..+/

To avoid files like this having their extension incorrectly returned:
Joomla_1.5.0-Stable-Full_Package.zip

We can't grab the .tar.gz or .tar.bz2 files or the world though perhaps we might want to put detection for that in as well.
Sam Moffatt
Updater, Installer and Authentication Systems
JoomlaCode Backend Systems
Pie.


Locked

Return to “Under Review - Archived”